1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
aivan3 [116]
2 years ago
14

Where does the CPU store its computations?

Computers and Technology
1 answer:
Tpy6a [65]2 years ago
7 0

Answer: A. Registers

Explanation:

You might be interested in
This exercise asks you to write a program that tests some of the built-in subroutines for working with Strings. The program shou
klasskru [66]

Answer:

Java.

Explanation:

// Get user input

System.out.print("Please enter your first name and last name separated by a space: ");

userInput = TextIO.getln();

// Find index of space character

int spaceIndex = userInput.indexOf(' ');

// Extract first and last name using space character index

// I have used length() method to get length of string userInput.

String firstName = userInput.substring(0, spaceIndex-1);

String lastName = userInput.substring(spaceIndex+1, userInput.length()-1);

// Print the required statements

System.out.print("Your first Name is %s, which has %d characters%n", firstName, firstName.length());

System.out.print("Your last Name is %s, which has %d characters%n", lastName, lastName.length());

// I have used space character Index to get the Initial of last name

System.out.print("Your initials are %s%s", firstName.substring(0,0), lastName.substring(spaceIndex+1, spaceIndex+1));

5 0
2 years ago
Write a program that simulates a lottery. The program should havean array of five integers named lottery, and shouldgenerate a r
Fiesta28 [93]

Answer:

Here is the C++ program that simulates lottery:

#include<iostream>  //to use input output functions

using namespace std;  //to access objects cin cout

int main(){  //start of main function

int size= 5; // size of arrays

int range = 10;  //range of random numbers from 0 to 9

int user[size];  // user array

int lottery[size];  // lottery array

for(int i=0;i<size;i++)  //iterates through the array

lottery[i]=rand()%range;  // generates random number in specified range

cout<<"Enter "<<size<<" digits: ";  //prompts user to enter 5 digits

for(int i=0;i<size;i++)  //loops through the user array

cin>>user[i];  //reads input digits from user

int match=0;  //stores number of matching digits

for(int i=0;i<size;i++)  //iterates through array to compare user and lottery arrays

if(user[i]==lottery[i])  //if digit at i-th index of user array matches to that of lottery array

match++;  //increments count of matching digits by 1

cout<<"Lottery array: ";  // display digits of lottery array

for(int i=0;i<size;i++)  //iterates through elements of lottery array

cout<<lottery[i]<<" ";  //prints elements of lottery array with a space between them

cout<<endl;  //prints a new line

cout<<"  User  array: ";  // prints digits of user array

for(int i=0;i<size;i++) //iterates through elements of user array

cout<<user[i]<<" ";  //prints elements of user array

cout<<endl;  // prints a new line

if(match==size){  //if all the digits match

cout<<"Congratulations. You are a grand prize winner! "; }//displays this message proclaiming the user as a grand prize winner

else{  // if all digits of user array do not match with lottery array digits

cout<<"Number of digits matched: "<<match<<endl; //displays the number of matched digits

cout<<"Sorry! Better luck next time!" ;    //displays this message when all digits don't match

}

}    

Explanation:

If you want to keep the size and range fixed then you can use #define before the main() function to give a constant value to size and range as:

#define size 5

#define range 10

The program uses rand() function in order to generate random numbers for lottery array in the range of 0 through 9.

Then the program declares a user array with size = 5 and prompts user to enter 5 digits to stores in user array.

Next the program matches each digit of user array to the corresponding digit of lottery array and if the two digits match then the program increments the match variable by 1 to count the matched digits. For example, lets say lottery has the following elements:

lottery: 7,4,9,1,3

Lets say user array has following elements input by user at console

user: 4,2,9,7,3

Now at first iteration the digit 7 at 0-th index of lottery array is matched to the digit 4 at 0-th index of user array. This index is specified using variable i. These means the first element of lottery array is matched with first element of user array. As these digits are not equal so they don't match and the variable i is incremented to point to the position of next digit.

Now at second iteration the digit 4 in lottery array is matched to the digit 2 of user array. As these digits are not equal so they don't match and the variable i is incremented.

at third iteration the digit 9 in lottery array is matched to the digit 9 of user array. As these digits equal so they match and the variable match is incremented to 1 in order to count the number of matches. So value of match = 1

Now at fourth iteration the digit 1 in lottery array is matched to the digit 7 of user array. As these digits are not equal so they don't match and the variable i is incremented. The value of match also remains the same i.e. 1

at fifth iteration the digit 3 in lottery array is matched to the digit 3 of user array. As these digits equal so they match and the variable match is incremented to 1 in order to count the number of matches. So value of match = 2

Next the loop ends because the value of exceeds 5 which is the size of the array.

Next if(match==size) statement has an if condition which checks if all digits match. This is checked by comparing the count of match variable to the size of the array. The value of match is 2 and value of size is 5 so this means that all the digits do not match. Hence this condition evaluates to false. So the statement in if part will not execute and program moves to the statement: cout<<"Number of digits matched: "<<match<<endl; which displays the value of match variable i.e. 2 as:

Number of digits matched: 2

followed by statement cout<<"Sorry! Better luck next time!" ;  which displays the message:

Sorry! Better luck next time!

5 0
2 years ago
HELP BRAINLIEST FOR RIGHT ANSWER
Scilla [17]

Answer:

true I know this cuz I smart

7 0
3 years ago
Read 2 more answers
• Microsoft Windows 7 Operating System • 7-Zip • Adobe Acrobat Professional • Adobe Reader • Google Chrome • Microsoft Internet
inysia [295]

All are software applications except Microsoft windows 7 operating system

8 0
2 years ago
Write switch-case statement that displays the following information if the temperature is the input Activities at Lake LazyDays
Marta_Voda [28]

Answer:

//here is code in c++.

#include <bits/stdc++.h>

using namespace std;

int main()

{

// variable

int temp;

cout<<"Please enter the temperature:";

//read temperature from user

cin>>temp;

int n;

// reduce the case for switch

n=temp/10;

// print output according to the switch case

switch (n) {

case 7:

case 6:

cout<<"tennis"<<endl;

break;

case 5:

case 4:

cout<<"golf"<<endl;

break;

default:

if(temp>=80)

cout<<"swimming"<<endl;

else

cout<<"skiing"<<endl;

break;

}

return 0;

}

Explanation:

Read the value of temperature from user and assign it to variable "temp".

Calculate n=temp/10, to limit the number of cases in the switch statement.

if temperature is greater or equal 60 & less than 80, it will print "tennis".

If temperature is greater or equal 40 & less than 60, it will print "golf".

in default case, if temperature is greater than 80, it will print "swimming".

if less than 40, print "skiing".  

Output:

Please enter  the temperature::67                                                                                        

tennis

3 0
3 years ago
Other questions:
  • What does the machine do and how do the operators react to their work?
    13·1 answer
  • Janelle is shopping for jeans from Express. She clicks on a style she likes. The site quickly presents her with a close-up view
    5·1 answer
  • Ipv6 includes a native information security framework (ipsec) that provides both data and control packets. true false
    15·1 answer
  • Ross has to create a presentation for his class but can't decide on a topic. What should he do?
    14·2 answers
  • Write a program whose input is two integers and whose output is the two integers swapped. Ex: If the input is: 3 8 then the outp
    12·1 answer
  • An individual who understands and uses a variety of symbols yet uses one symbol at a time to share a message needs more developm
    10·1 answer
  • A ____ object is used to hold data that is retrieved from a database via the OleDbDataAdapter connection. a. DataRecord b. DataS
    12·2 answers
  • All computer systems have
    14·2 answers
  • If you need to multiply 50 and 8 and divide by 2, what would you type on the numerlc keypad?
    10·1 answer
  • The unit we use to measure bending moment is...<br> A kg<br> B N<br> C Nm<br> D MPa
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!