Thursday, July 30, 2009

C++ anyone??? urgent?

I hv a c++ project due for 5 days n i hv 2 make it look cool...so i needa use the setw() manipulator at a point but...


also i needed to use microsoft visual c++ and in that getch() %26amp; cout dont go together(if u use them nearby,cout satement is executed at end of the program)


so i hadta use the printf statement everywhere...but noe how do i incorporate the setw() in printf...is dere ne way???


or can i use nething else of that sort???nething wil dooo....???


pls help...


relly urgent

C++ anyone??? urgent?
A precise answer to this question of yours is hard to give


Long before you take it seriously


Perhaps you'll even forget what you asked


Easy way to find it out right away is:


RE-THINKING of the issue...





Have a nice day!
Reply:I agree with inline_function that it is bad programming style to use printf in C++. However, maybe you haven't time to go back and change your program to use iostreams again.





You can do the same thing using the width field in your printf format strings. See the documentation for printf in the Visual Studio help for further details.
Reply:That's source code----
Reply:you can use a function called "flush" with cout to flush the text out before the end of the function. See source below
Reply:come to online chate with me
Reply:Its not clear why u are using getch()? If you want to input a character you can use :-


char ch;


cin.get(ch);


cout%26lt;%26lt;ch;


manipulators like setw() etc are defined in iomanip.h file.





Do not mix printf() (stdio.h , c library) with c++ program. Its bad programming practice.


No comments:

Post a Comment