Question

Turning this into C++ start Declarations int nums[3] for (int =0; i<3, i++) output "Enter number"...

Turning this into C++

start

Declarations

int nums[3]

for (int =0; i<3, i++)

output "Enter number"

input value

output "Enter number"

input value

output "Enter number"

input value

end

Homework Answers

Answer #1

Solution

Code

#include <iostream>

using namespace std;

int main()
{
int nums[3];
for(int i=0;i<3;i++)
{
cout<<"Enter Number: ";
cin>>nums[i];
}

return 0;
}

Screenshot

Output

--

as per the pseudocode it is only asking input

if you want to display the output you can use for loop and cout<<nums[i]; to display

all the best

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
convert the while loop into for loop x = int(input('Enter initial value: ')) count = 0...
convert the while loop into for loop x = int(input('Enter initial value: ')) count = 0 if(x<1): print('Error') exit() print('Initial value is: ',x,' ',end='') while(x!=1): if(x%2==0): x=x/2 else: x=3*x+1 count+=1 if(x!=1): rint('Next value is: ',int(x),' ',end='') else: print('Final value ',int(x),', ',end='') print('number of operations performed ',int(count),' ',end='') break
d = int(input('Enter the date: ')) m = int(input('Enter the month: ')) y = int(input('Enter the...
d = int(input('Enter the date: ')) m = int(input('Enter the month: ')) y = int(input('Enter the year: ')) if m<3: m = m + 12 y = y - 1 a = (2*m) + (6*(m+1)/10) b = y + (y/4) + (y/400) - (y/100) c = d + a + b + 1 f = c / 7 if f == 0: print ('Sunday') elif f == 1: print ('Monday') elif f == 2: print ('Tuesday') elif f ==3: print...
Write a C function to compute the following output (int) based on two input (int) variables:...
Write a C function to compute the following output (int) based on two input (int) variables: output = a*a + b*b - 2*a*b If the value of output is '0', then return -1 instead. Call the C function 4 times from main() with values of 'a' and 'b' as follows and print output values for each case. a = 3, b = 4 a = 1, b = 1 a = -2 b = 3 a = -4 b =...
Give the output of the program using Call-By-Reference: int i, a[3]; void f (int x, int...
Give the output of the program using Call-By-Reference: int i, a[3]; void f (int x, int y){ x = (x*y) mod 3; y = y – x; } main(){ i = 0; a[0] = 1; a[1] = 2; a[2] = 0; f(i, a[i]); print(“%d %d %d %d\n”, i, a[0], a[1], a[2]); f(a[i], a[i]); print(“%d %d %d\n”, a[0], a[1], a[2]); }
void phase03(){ int a = atoi(next_input()); int b = atoi(next_input()); int c = atoi(next_input()); int d...
void phase03(){ int a = atoi(next_input()); int b = atoi(next_input()); int c = atoi(next_input()); int d = atoi(next_input()); int targ = 1 << ((hash % 7)+24) | 1 << (hash % 17) | 1 << (hash % 19); int shot = 1 << a | 1 << b | 1 << c | 1 << d; int hit = shot ^ targ; hit = !hit; if(hit){ return; } failure("Shifty bits hit? Xor not it seems..."); } void substring(char *dest, char...
int main() { int i, j, sum = 0; for(i=0;i<3;i++) { for(j=0;j<4;j++) { if(j > 2)...
int main() { int i, j, sum = 0; for(i=0;i<3;i++) { for(j=0;j<4;j++) { if(j > 2) break; sum++; } } } What is value of sum, explain.
debug the following 1) // The main program calls a method that // prompts for and...
debug the following 1) // The main program calls a method that // prompts for and returns a name start Declarations string usersName name = askUserForName() output "Your name is ", usersName stop string askUserForName() Declarations string name output "Please type your name " input usersName return 2) // The main program passes a user’s entry to // a method that displays a multiplication table // using the entered value. The table includes the // value multiplied by every factor...
How would I write this function in C programming language? Function header: int input(int *a, int...
How would I write this function in C programming language? Function header: int input(int *a, int *b, int *c) This function should attempt to input 3 integers from the keyboard and store them in the memory locations pointed to by a, b, and c. The input may not be successful in reading all three values. The function should return the number of values that were successfully read.
Consider the following function: double arrayavg(int a[], int n){ int sum=0; for(int i=0; i!=n; ++i){ sum+=a[i];...
Consider the following function: double arrayavg(int a[], int n){ int sum=0; for(int i=0; i!=n; ++i){ sum+=a[i]; } return (double)sum/n; } Rewrite the function to eliminate the array subscripting (a[i]), using pointer arithmatic instead. Write a program that reads a line of input and checks if it is a palindrome (ignoring spaces) Write a program that takes the name of a file as a command line argument, and prints the contents of the file (similar to the linux 'cat' program). Write...
int i,sum=0;   int array[8]={//You decide this};   int *a,*b,*c;   a = array;   b = &array[3];   c =...
int i,sum=0;   int array[8]={//You decide this};   int *a,*b,*c;   a = array;   b = &array[3];   c = &array[5];   c[-1] = 2;   array[1] = b[1]-1;   *(c+1) = (b[-1]=5) + 2;   sum += *(a+2) + *(b+2) + *(c+2);   printf("%d %d %d %d\n", sum, array[b-a], array[c-a], *a-*b); array[8]={ ?? }; what is array[8]?
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT