I need a out put just like this:
that will move to end
john123--%26gt;%26gt;
like this code bath it is wrong i need code that will move my name to the bottom
#include%26lt;iostream.h%26gt;
#include%26lt;conio.h%26gt;
#include%26lt;stdlib.h%26gt;
#include%26lt;dos.h%26gt;
main()
{
int i;
int m;
clrscr();
for (i=0;i%26lt;6;i++)
{
cout%26lt;%26lt;m;
delay(900);
cout%26lt;%26lt;"mike";
delay(100);
}
getch();
}
ty and more power
Turbo C++ help?
OK....Not sure what you want but
Seeing cout prints one character from the pointer, "mike",
it should only print "m"; ONE CHARACTER = cout.
That is why you are doing the for loop.....so that you can print each of the CHARACTERS of an array! Did you fall asleep or party too much?
Your code should look closer to
int i;
int m;
char name[10] = "mike";
clrscr();
//for (i=0;i%26lt;6;i++)
for (i=0;i%26lt;strlen(name);i++) // if you can use the str functions
or for (i=0;name[i]!=0;i++) // as 0 is a string terminator sometimes...old pascal.
{
cout%26lt;%26lt;name[i];
}
// then cout any other chars like the %26gt;%26gt;
I saw other post....so cout might handle the string length for you....I assumed it was character only based on an old naming style for functions...
Remember %26lt;%26lt; and %26gt;%26gt; are pipes that feed information to other programs, in this case, your console controller.
?? a question would then be why not cin instead of getch?
Reply:instead of cout%26lt;%26lt;m;
do cout%26lt;%26lt;endl;
Reply:you don't need a loop
you can input any name using cin%26gt;%26gt;
like
cin%26gt;%26gt;m(to enter the name you want)
cout%26lt;%26lt;m
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment