Further help regarding this code, im trying to make a program that compute radius and the output will be diameter and area and vice versa for the others but first i need to figure out how to finish radius.
#include<iostream.h>
#include<conio.h>
int main(void)
{
int choice, radius, diameter, area;
cout<<"Enter your Choice: "<<endl;
cout<<"1. Radius "<<endl;
cout<<"2. Diameter "<<endl;
cout<<"3. Area "<<endl:
cout<<"Enter desired number: "<<endl;
cin>>choice;
//for radius
if(choice==1)
{
constdouble PI=3.14159;
double radius;
cout<<"Input number: "<<endl;
cin>>radius;
double diameter=2*radius;
double area=PI*radius*radius;
//output for radius
cout<<"The Area and Diameter is "<<endl;
cout<<"Area="<<area<<endl;
cout<<"Diameter="<<diameter<<endl;
}
clrscr();
return 0;
}
i can already run the program but after inputing my desired radius, the program will suddenly shutdown and go back to where im encoding the codes.
tried to delete the clrscr() and saw that the program actually converts it but the main problems is as i stated, "After i INPUT the radius, it will go back to where i encode it. pls can anyone state whats wrong with this?
thx very much. :D
sry if my question is somewhat repetitive.
After i INPUT the radius, it will go back to where i encode it
What do you mean by "encode" exactly?
Calling clrsrc() will clear the entire console window of any text (or move any text upwards until it looks that way), so it may seem like nothing has happened. Is that what you are referring to?
sorry if i said it in a very vague manner, the part of the C++ where we write the code, the blue background one.
i just tried removing the clrsrc(), that time i saw that my program works since it will not erase the previous right? saw that my program converted the radius and the above supposed output appeared there.
my real problem regards to the radius. where in line 24 where i supposed to input the radius to be converted, "After i input the number" it will go back to the blue background where we type the codes.
tried the suggestions in that specific link, its very informative but it didnt help my problem. it still go back to the main screen whenever i input a number to be converted.