Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Maybe you guys can help w/ C++

Status
Not open for further replies.

Deathshead

New Member
Using Microsoft Visual C++:

IM GETTING THIS ERROR

error C2676: binary '<<' : 'class istream_withassign' does not define this operator or a conversion to a type acceptable to the predefined operator
Error executing cl.exe.
 
I should be able to help you, but at least post the line that is causing it to give you that error.

Also, make sure to post the declaration of all variables used in that line.
 
actually i found out what was wrong However, heres a new problem

it says that diameter, radius,circum, and area have not been initialized
heres the prog:


#include<iostream.h>
#include<math.h>
void main()

{ double radius;
double number;
double diameter;
double circumference;
double area;

cout<< "Enter the radius"<<endl;
cin>> number;

cout<< "The diameter for your circle is"<< diameter<<endl;
diameter=radius*2;

cout<< "The circumference is"<<circumference<<endl;
circumference=2*3.14159*radius;

cout<< " The area is"<<area<<endl;
area=3.14159*radius*radius;
}
 
you need to calculate the values for the diameter, circumference, and area BEFORE you try to output them, not after...

that will take care of those three... but your other problem is you're not inputting OR calculating the radius. your input goes to 'number' when it should probably go to 'radius'

try this:

Code:
#include<iostream.h> 
#include<math.h> 
void main() 

{ 
double radius; 
double diameter; 
double circumference; 
double area; 

cout<< "Enter the radius"<<endl; 
cin>> radius; 

diameter=radius*2; 
cout<< "The diameter for your circle is"<< diameter<<endl; 

circumference=2*3.14159*radius; 
cout<< "The circumference is"<<circumference<<endl; 

area=3.14159*radius*radius; 
cout<< " The area is"<<area<<endl;
}
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top