undefined symbol "cout", "cin", and "endl"

I have written a program to calculate the price of a phone call. There is a $1.99 connection fee. The first 3 minutes are automatically charged: $2.00. The price of each additional minute is 45 cents. I have the code planned and written out well but it's returning an undefined symbol error. Any ideas???



#include <iostream>
#include <string>

int minutes;
float connectionFee = 1.99;
float first = 2.00;
float total;

int main()
{
cout << "How many minutes did the call last?" << endl;
cin >> minutes;
cout << endl;

if (minutes <= 3)
{
cout << "You have been charged $" << connectionFee;
cout << " for a connection fee and $" << first << " for the first three minutes.";
cout << endl << "Your total is " << connectionFee + first << endl << endl;
}

total = (minutes - 3) * .45;

{
cout << "You have been charged $" << connectionFee;
cout << " for a connection fee, $" << first << " for the first three minutes, and ";
cout << "45 cents per minute for each additional minute.";
cout << "Your total is $" << total << '.';
}
return 0;
}
you need to insert

using namespace std;

after your header files, or you'll have to do it like

1
2
3
std::cout << "How many minutes did the call last?" << std::endl;
std::cin >> minutes;
std::cout << std::endl;
wow! beginning programmers can really miss the easy stuff. I completely forgot to put that in there. thank you.
lolz, you're welcome. I'm glad I could help.
Topic archived. No new replies allowed.