So i am in desperate need of help in my C++ Programming I class.
Here is what the program calls for:
Module Two Program
Program: The user has a one year contract with cell phone company WireMore. WireMore has multiple plans to choose from that charge a monthly fee for a set number of minutes, plus 35 cents per minute for each minute over the monthly maximum. WireMore does not allow their user to carry unused minutes over from one month to the next. The user will input the monthly fee and monthly minutes allowed for two possible calling plans. The user will then enter the number of minutes he or she has used on their current calling plan for each of the last 12 months. Your program should output which plan would have best suited the user over the past year, and how much money the user would have saved by choosing the better plan.
Note: Your program should not allow the user to input negative quantities for the monthly fee, minutes allowed, or minutes used.
The only problem is, instead of declaring like 12 variables for the user's minutes used per month on their current plan, what could I do? Also, how do I account for minutes used over the monthly maximum? Any help would be greatly appreciated.
Hi - I could use some suggestions on loops as well. I am new to C++ and have to write code for a Number Guessing Game. I have the random number and seed functions working fine.
I cant figure out how to creat a loop that will count the number of guesses the user makes. I am using a for loop and I am getting a weird total. I "cout'd" my random number to try and help me figure this out.
Any help would be appreciated.
// Number Guessing Game//
// Applies the rand, srand() functions and loops//
srand(time(0));
int randomNumber = rand() % 1000 + 1; // generates random number between 1 and 1000.
int guess = 0;
int total = 0;
int iter = 0 ;
cout << randomNumber << endl ; //used to trouble shoot random number.
cout << " Welcome to Guess-the-Number Game." << endl ; // Title of program.
cout << "" << endl ;
cout << " I have a secret number between 1 - 1000." << endl ;
cout << " Can you guess my number ?." << endl ;
cout << "" << endl ;
do
{
cin >> guess ;
cout << "" << endl ;
if (guess < randomNumber) // If guess is lower than the random number.
cout << " Too low. Try again. " << endl ;
if (guess > randomNumber)
cout << " Too high. Try again." << endl; // If guess is higher than the random number.
}while (guess != randomNumber); // While guess is not equal to the random number.
cout << " Excellent! you guessed the number! " << endl ;
cout << " " << endl ;
// count number of guesses.
for (int iter=1; iter <= 11; iter++){
total = total + iter;
}
cout << "The total number of guesses you made was " << total << endl;