Need help with this while loop, pretty please?
I have to set my cin's and cout's to work in a while loop. The way it is supposed to work is, the loop will end once someone enters "-999" as the int number... as you can see below. I have yet to add in the function call and other things, but I think I have come far enough to be able to ask this. I think if I put the cin << number; in the loop, it will not terminate because it will not check until it has gone thru everything. Can someone tell me what to do please?
Code:
#include <iostream>
#include <iomanip>
using namespace std;
double commission (double actualsales, double basesales, double compercent);
//function for the program
int main ()
{ //the int main has begun
string name;
int number;
double basepay, compsales, printsales, compcom, printcom, totalcom, totalpay;
cout << "Welcome to the APSU Computer Company Commission Statement program!" << endl;
cout << "Please Enter Salesperson's Identification or -999 to terminate." << endl;
cin >> number;
cout << "Please Enter Salesperson's Name." << endl;
cin.ignore (80, '\n');
getline (cin, name);
cout << "Please Enter Salesman Base Salary." << endl;
cin >> basepay;
cout << "Please Enter Personal Computer Sales." << endl;
cin >> compsales;
cout << "Please Enter Printer Sales." << endl;
cin >> printsales;
}//the int main has ended. oh my!
double commission (double actualsales, double basesales, double compercent)
{//birth of a function
double comm;
if (actual sales > basepay)
{
comm = actualsales * compercent;
//and you get to keep your job :)
}
else
{
comm = 0;
}
return comm;
}//death of a function