0
can i wrote a program to do integer and float program by one input at a time????
can i wrote a program to do integer and float program by one input at a time ,for example :if enter 5 ,then output integer's function executed, and if enter with fractional part then output float function executed.
2 Answers
0
Something like this :
main(){
float no;
float Fahrenheit, Celsius;
cout<<"Enter a number:";
cin>>no;
//here logic
//(no==float_type) do this...
if(no==float_type){
Fahrenheit =(Celsius*(9/5)+no;
cout<<"Fahrenheit Temp : "<<Fahrenheit;
}//(no==int_type) do this...
else{
celcius =(5/9)*(Fahrenheit-32);
cout<<"Celsius Temp: "<<Celsius;
}
}