...

View Full Version : why wont it work



saadhamza
07-05-2009, 12:40 AM
why doesnt this code work?



#include <iostream>
#include <cmath> // or math.h

int main()
{
using namespace std;

double area;
cout << "Enter the floor area, in square feet, of your home: ";
cin >> area;
double side;
side = sqrt(area);
cout << "That's the equivalent of a
<< " feet to the side." << endl;
cout << "How fascinating!" << endl;
return 0;
}

tomws
07-05-2009, 02:04 AM
I'll bet that your error message has some helpful information.

adarshakb
07-05-2009, 10:58 AM
This code works:
I noticed error in the pasted code of a missing "
exactly :
"<<side<< was missing in the output line:thumbsup:
#include <iostream>
#include <cmath> // or math.h

int main()
{
using namespace std;

double area;
cout << "Enter the floor area, in square feet, of your home: ";
cin >> area;
double side;
side = sqrt(area);
cout << "That's the equivalent of a "<<side<< " feet to the side." << endl;
cout << "How fascinating!" << endl;
return 0;
}
lol hope it answered

BrickInTheWall
07-05-2009, 12:57 PM
cout << "That's the equivalent of a
<< " feet to the side." << endl;

there are quotes missing after the 'a' ----> "That's the equivalent of a"



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum