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 :
#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;?
#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