With their running sums,their squareroots and squares
How can I write a C++ program that reads in a list of nos. from 0-25?
It's not clear to me why you need to store these numbers in an array or other data structure. The running sum can be stored in a single variable and updated with each new number read. The squareroot and square of each number can be printed out just after the new number is read.
Is this what you mean? Perhaps part of the trouble is that you really haven't phrased your question well.
Reply:#include %26lt;iostream.h%26gt;
void main()
{
int list[50];
cout %26lt;%26lt; "\n Enter the list : ";
for(int i = 0 ; i %26lt; 25 ; i++ )
{
cin %26gt;%26gt; list[i];
}
}
Reply:Please tell me if you are using arrays, iterators, vectors, and obects....
I suggest the best simple aproch would be creating an vector in a while loop as each new number comes in have your vector create a new element. When your number entry is done take these element and do you mathematical computations and store them in sperate variables....
I hope this helps you let me know
Reply:There are many different ways to handle this, e.g., list, array, vector, etc.. Just use a WHILE/DO loop to read the list in, with the condition to filter out anything not falls into {0,...,25}, and just add them all together to get the sum, then use SQRT(sum), and SUM*SUM to get the rest.
Reply:I'd suggest you learn English more than C++.
Anywho, the "DO" variable may be what you're looking for.
Reply:Don't sell youself short! Strive to achieve. Go for the A++ program. You can do it if you try.....
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment