creating a simple program for class

hey guys im new in c++ scripting... there is a problem could somebody help me?
i tried to script a simple program to get 10 numbers from the user and calculate the minimum of the numbers that user entered... here is what i wrote :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream.h>
#include <conio.h>

int main()
{
	int a,b;
	int i;
	int min;
	i=0;
	cout<<"Please enter 10 numbers to calculate the min:"
	cin>>i;
	while(i<=10)
	{
		cout<<"Please enter number "<<i<<":";
		cin>>a;
		min=a<i;
		i++;
	}
	cout<<"Result of calculate:"<<min;

}

but it gives me 1 error on " cin>>i;" line. do you guys know how to fix this problem? :S
what is i? you want the user to enter 10 numbers but first you ask i. what is it supposed to do ?
if i'm correct i should have the value of 1 so it ask 10 times a number.
and what do you mean with min=a<i;?
Last edited on
1)use ;
2) why are you inputting i if you want 10 numbers.
3)i<=10 inouts 11 numbers
4)use
1
2
3
4
5
6
7
8
9
10
cin>>a;
min=a;
while(i<9)
{
                cout<<"Please enter number "<<i+1<<":";
		cin>>a;
		if(min>a)
                      min=a;
		i++;
}

5)why use b?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream.h>
#include <conio.h>

int main()
{
	int a,b;
	int i;
	int min;
	i=0;
	cout<<"Please enter 10 numbers to calculate the min:"
	cin>>a;
	min=a;
	while(i<9)
	{
		cout<<"Please enter number "<<i+1<<":";
		cin>>a;
		if(min>a)
		min=a;
		i++;
}
	cout<<"Result of calculate:"<<min;

}

@akshit still having that error :| sry if im a lil noob :s you see how i edited from the code above :S
add ; at line 10 (at the end)
oh what the... :D i even didnt see that xD thanks for help guys :)
I forgot to add line no. at end of point 1 on my previous post.
You need to be using namespace std; too.
from the code I think he is in Turbo c++(old compiler).Thats why he used .h in header file.
In old Turbo C++ ver3 namespaces are not there.
Topic archived. No new replies allowed.