Question

In: Computer Science

(Do the algorithm and flowchart) Write a C++ program that reads integer numbers and print it...

(Do the algorithm and flowchart)

Write a C++ program that reads integer numbers and print it in horizontal order of the screen

Solutions

Expert Solution

1. Firs we are going to write the algorithm for the following question :

Step 1: Start
Step 2: Declare the variable n, i and array arr 
Step 3: Initialize the variable
          arr[] <- {1,2,3,4,5,6}
          n <- size of array arr
          i <- 0
Step 4: Repeat the steps until i < n
     4.1: Read the value of array index arr[i]
     4.2: Display the value of arr index arr[i]
     4.3: Increament the value of i
          i <- i + 1
Step 7: Stop

Explanation :

1. Here we are simply taken 3 variable an array arr, an var n which stores the size of array and and var i for accessing array index

2. In Step 3 we initialize all three variables

2. we then execute a while untill the value of i is less than the size of n and print the value at each index of array and also increment he variable i

-----------------------------------------------------------------------------------------------------------------------------------------------------------------

2. FlowChart :

Above flowchart is self explanatory, however if you feel any doubt lease feel to ask.


Related Solutions

The Sum and The Average In C++, Write a program that reads in 10 integer numbers....
The Sum and The Average In C++, Write a program that reads in 10 integer numbers. Your program should do the following things: Use a Do statement Determine the number positive or negative Count the numbers of positive numbers, and negative Outputs the sum of: all the numbers greater than zero all the numbers less than zero (which will be a negative number or zero) all the numbers Calculate the average of all the numbers. The user enters the ten...
Write a program (in Q0.c) to do the following: In main(), declare an integer x. Print...
Write a program (in Q0.c) to do the following: In main(), declare an integer x. Print the address of x (using the address-of operator). Pass x as an argument to a function void fooA(int* iptr). (Hint: can you pass x itself directly?) In fooA(int* iptr), print the value of the integer pointed to by iptr, the address pointed to by iptr, and the address of iptr itself. In the main function, following the call to fooA(...) , print the value...
In c++ Write a program that reads a string consisting of a positive integer or a...
In c++ Write a program that reads a string consisting of a positive integer or a positive decimal number and converts the number to the numeric format. If the string consists of a decimal number, the program must use a stack to convert the decimal number to the numeric format. Use the STL stack
In c++, write a program that reads a string consisting of a positive integer or a...
In c++, write a program that reads a string consisting of a positive integer or a positive decimal number and converts the number to the numeric format. If the string consists of a decimal number, the program must use a stack to convert the decimal number to the numeric format.
Write a C program that reads an integer value. Assume it is the number of a...
Write a C program that reads an integer value. Assume it is the number of a month of the year; print out the name of that month (Hint: months need to be captured in an array).
Java Write a program that reads 4 integer numbers from the user combine it into a...
Java Write a program that reads 4 integer numbers from the user combine it into a single number. You need to ask the user to first specify how to combine the numbers (forward or backward). Note that for the backward option you need to check that the last digits should be 0, also for the forward option you need to check that the fist digit is not 0. Use for loops and switch for the menu.                       4. Write an application...
who to write a program c++ that reads in an integer between 0 and 1000 and...
who to write a program c++ that reads in an integer between 0 and 1000 and adds all the digits in the integer?
Let a , b , c be three integer numbers. Write a C++ program with a...
Let a , b , c be three integer numbers. Write a C++ program with a functions void rotate1(int* a,int* b,int* c) void rotate2(int& a,int& b,int& c) such that a -> b , b -> c and c -> a. Thus we use two different approaches (pointers in rotate1 and references in rotate2).
C program, please Write a program that reads a sequence of 10 integer inputs and prints...
C program, please Write a program that reads a sequence of 10 integer inputs and prints the smallest and largest of the inputs and the number of even and odd inputs. for a beginner please, you could use a while loop,if-else,
(C++) Write a nested loop that reads an integer n (n>0) from the keyboard and print...
(C++) Write a nested loop that reads an integer n (n>0) from the keyboard and print out "n" lines as follows: 0 0 1 0 1 2 0 1 2 3 … 0 1 2 3 … n-1
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT