Sunday, July 12, 2009

How to write c program for finding average ,total & get inputs from users without using scanf & printf?

importanat

How to write c program for finding average ,total %26amp; get inputs from users without using scanf %26amp; printf?
In c++





int num1, num2, total;


float average;





cout%26lt;%26lt;"Please input 2 numbers";


cin%26gt;%26gt;num1%26gt;%26gt;num2;





total=num1+num2;





cout%26lt;%26lt;"Total of two numbers"%26lt;%26lt;total;


average=total/2;


cout%26lt;%26lt;"Average of two numbers"%26lt;%26lt;average;
Reply:What I/O libraries do you have available to you? There's also putc and getc, for example. If you can use C++ there's iostreams, i.e. cout and cin. Difficult to answer without more context.


No comments:

Post a Comment