P
phenix151
I am tring to read numbers from the command line. they are to be input like this:
12.34 14.67 82 227 -17
I know how many numbers are to be input by asking.
I want to put this in a for or a do/while loop, but it never reads all of the data.
here is the code snippit:
cout<<"enter the data"<<endl;
for (i =0; i <= intuserInput; i++)
{
cin>>dblVar1; //reads the line one at a time
if(i==0)
{dblLgst = dblVar1; // the first number read is the largest
}
if(dblVar1 == dblLgst) //check for duplicates
dup++;
if(dblVar1 > dblLgst) //
dblLgst = dblVar1;
}
Thanks
Mike
12.34 14.67 82 227 -17
I know how many numbers are to be input by asking.
I want to put this in a for or a do/while loop, but it never reads all of the data.
here is the code snippit:
cout<<"enter the data"<<endl;
for (i =0; i <= intuserInput; i++)
{
cin>>dblVar1; //reads the line one at a time
if(i==0)
{dblLgst = dblVar1; // the first number read is the largest
}
if(dblVar1 == dblLgst) //check for duplicates
dup++;
if(dblVar1 > dblLgst) //
dblLgst = dblVar1;
}
Thanks
Mike