C++ Arrays

Associate
Joined
6 Mar 2009
Posts
495
Hi, i'm starting to learn C++ and its really confusing me! I want to create a program that will prompt the user to enter 10 numbers and when they are entered there are stored inside an Array and then printed to screen.

I know it sounds quite easy but im struggling a little:(

Any suggestions please..
 
Thanks for the response. This is what i have done so far:

#include <iostream>

using namespace std;

int main()
{
int nums[10];
int i=0;

cout << "Please enter a number";

for(i=0;i<=10;i++)
{
cout << nums;
}

return 0;

}
 
Ah thanks a millions thats great help:)

Have another small query. When i create an new C++ file to run the above code when i hit F5 to run it says that the file cannot be found:( Any suggestions??
 
Heys Guys im back again and need a little more help:)

I am having problems with methods as im getting errors when i go call them. I am looking to used different methods to find the smallest,largest,median etc of numbers that are entered by the user. Here is the code so far:

#include <iostream>
#include <conio.h>

using namespace std;

void totalNums(int total)
{
cout <<"The total amount of numbers entered is " << total;



}//totalNums()

int main()
{
int nums[10];
int total=0;

cout << "Please enter a number";

for(int i=0;i<10;i++)
{
cin >> nums;
}


for(int i=0;i<10;i++)
{
cout << nums;
cin.clear();
total++;
}
cout << endl;
totalNums();


getch();
return 0;

}

I am getting an error when i call the method totalNums();
 
Back
Top Bottom