ro***********@cfu.net 写道:
well here is what i have so far. having some probs with the variables
though.
as far as doing my homework for me, i am just dinking with this stuff.
if you dont wanna help then just move on with out any comments.
//test program
//user inputted numbers
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int number1;
cout<<"please enter an integer: "<<endl;
cin>>number1>>endl;
cout<<number1<<endl;
system ("pause");
return 0;
}
I will assume that you are working with dev-C++,
here's my code,hope it can help a little,btw,i have no idea why you want
to finish the loop with -99..isn't -99 an integer? :P
code:
#include <iostream>
using std::cin; using std::cout; using std::endl;
int main()
{
int maxlen;
int minlen;
int num;
int counter = 1;
cout << "Please enter No.1: ";
cin >> num;
maxlen = num;
minlen = num;
while(num != -99)
{
counter++;
cout << "Please enter No." << counter << ": ";
cin >> num;
if((maxlen < num) && (num != -99))
maxlen = num;
if((minlen > num) && (num != -99))
minlen = num;
}
cout << "so the biggest one is: " << maxlen << endl;
cout << "and the smallest one is: " << minlen << endl;
system("pause");
return 0;
}
think this code is not that clear...need someone to fix it :)
cheers.