+ 2
I've coded a program, but when i run, it says that it has a compilation error. What may be the reason??
#include <iostream> using namespace std; int main() { float Length, Breadth, arearec; cout<<"\n Enter Length"; cin>> Length; cout<<"\n Enter Breadth"; cin>> Breadth; arearec= Length*Breadth; cout<<"\n area of rec
10 Réponses
+ 2
first cout is missing closing quotation marks.
+ 1
#include <iostream>
using namespace std;
int main() {
float Length, Breadth, arearec;
cout<<"/n Enter Length";
cin>> Length;
cout<<"/n Enter Breadth";
cin>> Breadth;
arearec= Length*Breadth;
cout<<"/n area of rectangle"<<arearec;
}
+ 1
You have forgotten to close the first quotation mark
+ 1
I don't think /n exists. You probably meant \n for new line.
+ 1
What does the error say?
+ 1
I have no idea what it could be. Try changing float to double. Maybe it can't fit the decimal places into float.
0
thanks for replying my friend. what abt the edited code which is up. its not giving an answer
0
Well, I changed it from /n to \n, but its not working
0
#include <iostream>
using namespace std;
int main() {
float Length, Breadth, arearec;
cout<<"\n Enter Length";
cin>> Length;
cout<<"\n Enter Breadth";
cin>> Breadth;
arearec= Length*Breadth;
cout<<"\n area of rectangle"<<arearec;
}
Its giving a non-related output
0
Sorry, my friend MILAN. Even if I change into double, its not working.