#include<iostream>
#include<string>
using namespace std;
int main()
{
double min;
double BasicRate;
double CStates;
double FStates;
double cost = 0;
string inp = "";
string temp = "";
BasicRate = 0.02;
CStates = 1.25 * BasicRate;
FStates = 1.75 * BasicRate;
int callCount;
for(int i = 0; i < 10; i++)
{
temp = inp[0];
if(temp == "q" || temp == "Q") break;
cout << "------------------------------------------\n";
cout << "Q & A Telephone service.\n";
cout << "------------------------------------------\n";
cout << " plaease enter your destenation number ex."
"111-111-1111\n";
cin >> inp;
temp = inp[0] + inp[1] + inp[2];
{
if(temp == "405") cost = BasicRate * min * (rand() % 180);
if( temp == "550" || temp == "520") cost= CStates * min * (rand() %
180);
if(temp == "620" || temp == "650") cost = FStates * min * (rand() %
180);
cout << cost"\n";
}
cout << " over limit\n ";
}
Its not complete, Im just dividing and conquering portions at a time. when I run this program, it prompts the user to enter A phone number, after the user enters the phone number, it loops right back around to the beginning, which is ok for now. Im just trying to figure out how to make the program go throught the loop only 10 ten times then to tell the user his time is up. should I use a for loop or a while loop?

New Topic/Question
Reply



MultiQuote





|