Won't compile need criticism.

#include <iostream>
#include <cmath>

using namespace std;

const int MaxString = 32;
typedef char StringType[MaxString];

int main()

{

const int MaxString = 32;
double Dmins, Nmins, RPlan, PPlan, PPlanDay, PPlanNight;
typedef char StringType[MaxString];
StringType UserName;

// Get the users name.
cout << "Enter your name: ";
cin.getline(UserName, MaxString);

//Get the number of daytime minutes.
cout << "Enter the daytime minutes: ";
cin >> Dmins;

//Get the number of nighttime minutes.
cout << "Enter the nighttime minutes: ";
cin >> Nmins;

//Calculate the price for regular plan.
if (Dmins+Nmins)<=50;
{
RPlan=10;
}
else
{
RPlan=10+((Dmins+Nmins)*.2);
}

//Calculate the price for premium plan.
if Dmins<=75;
PPlanDay=0;
else
PPlanDay=Dmins*.1;

{
if (Nmins)<=100;
PPlanNight=0;
else
PPlanNight=Nmins*.05;
}
PPlan=25+(PPlanDay+PPlanNight);

//Print the plan that is the cheapest.

if RPlan < PPlan;
{
cout << UserName << ", you are better off with the " << RPlan << endl;
}
else
{
cout << UserName << ", you are better off with the " << PPlan << endl;
}

//Ask if there is anymore customers.



return 0;
}
All your if statements are wrong:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
if condition;{
	//...
}
//Wrong!

if (condition){
	//...
}
//Right!

if condition;
	//...
//Wrong!

if (condition)
	//...
//Right! 
Why you are defining const int MaxString and a typedef twice? An if statement goes like this:

Gah, helios beat me to the if statements :P

I would fix those errors, then come back and post again, using [c0de][/code] tags...(# under format). Then give us a list of errors please...it helps.
Last edited on
Topic archived. No new replies allowed.