Question:
how to make this c++ program ?
Ahmed
2012-10-25 23:53:59 UTC
I want to write a program that convert the numbered entered by the user to currency format

for example if the user entered 12345
the output is $12,345
and I must use the for loop
Four answers:
Vascular Improbability
2012-10-27 04:57:12 UTC
What do you need a for-loop for? Even in C, there is a way to do it with a simple printf, and C++ has similar, if freaking insane, ways of handling it through cout.
Trev
2012-10-26 00:01:14 UTC
program refDemo;



#include( "stdio.hhf" );



procedure refParm( var a:int32 );

begin refParm;



mov( a, eax );

mov( 12345, (type int32 [eax]));



end refParm;



static

i:int32:=5;



begin refDemo;



stdout.put( "(1) i=", i, nl );







Page 87

mov( 25, i );

stdout.put( "(2) i=", i, nl );

refParm( i );

stdout.put( "(3) i=", i, nl );





end refDemo;



The output produced by this code is



(1) i=5

(2) i=25

(3) i=12345
shearin
2016-12-12 11:30:45 UTC
no longer anymore, at one time C++ develop into basically an extension of C. on the grounds that then, C has replaced, and so has C++. although that being suggested it is no longer unusual for the same software to collect both C and C++. the approach is the same, yet there are basically some variations int he libraries that you want the compiler to link to.
Lynn
2012-10-26 12:24:33 UTC
Haha wow the first answer was way off... It's simple... You do have to use "$" in the cout's. You have to include iomanip and setprecision and fixed.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...