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.

28th May 2020, 12:47 AM
Satyendra Patel
Satyendra Patel - avatar
2 Respuestas
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; } }
30th May 2020, 1:26 AM
Satyendra Patel
Satyendra Patel - avatar