Hey, I have a question, and I know that it is going to be a wow-i-am-a-moron-how-did-i-forget-that type of question.
I am making a little program to find the total for a fine for a speeding driver. The user enters their actual speed, the speed limit, and if they were or were not using a seat belt. For every 1-mph over the limit, the fine is increased by $2.00. if there is no seatbelt, then that is +$42.00. the base fine is $80.00. I think that is all the information that you would need to know to help me. Here is the code, and below it is the error code!
Thanks a ton!
//Name: fine.cpp
//Author: Jake
//Date: November 26th 2008
//Description:
//
#include <iostream>
#include <string>
#include <cmath>
usingnamespace std;
int main()
{
string response ="n";
double limit;
double speed;
char a;
double extra;
do
{
cout << "Welcome to Fine Calculator!" << endl;
cout << "Please enter the Speed Limit:" << endl;
cin >> limit;
cout << "Please enter the Driver's Speed:" << endl;
cin >> speed;
cout << "Was Driver wearing a Seat Belt?: [y/n]" << endl;
cin >> a;
cout << "Thank you!" << endl;
if (a=="y")
{extra=42;}
if (a=="n")
{extra=0;}
cout << "Your total fine is: $" << 80+((speed-limit)*2)+a << endl;
cout << " " << endl;
cout << "Do you want to do this again? [enter y for yes]" << endl;
cin >> response;
}
while (response == "Y" || response == "Yes" || response == "y" || response == "yes");
}
1 2 3
fine.cpp: In function `int main()':
fine.cpp:31: ANSI C++ forbids comparison between pointer and integer
fine.cpp:34: ANSI C++ forbids comparison between pointer and integer