Computing.Net > Forums > Programming > Help in C++

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Help in C++

Reply to Message Icon

Name: LaSaia
Date: December 24, 2004 at 17:18:27 Pacific
OS: n/a
CPU/Ram: n/a
Comment:

I need some help please, how do you make a scrolling message, when ever you enter something. Or in other words, say for instance you type "Vote Yes!" for the input and the output would be for it to scroll across the screen.



Sponsored Link
Ads by Google

Response Number 1
Name: LaSaia
Date: December 24, 2004 at 17:28:29 Pacific
Reply:

void ReverseString(char *str)
{
int i = strlen(str);
cout << i << endl;
cout << "Input String: " << str << endl;

char *str1 = new char[80];

for (int x=0,y=i-1; x {
str1[x]=str[y];
}
str1[x]='\0';
cout << "Reversed String: "<< str1 << endl;
delete str1;
}

or this:

int Reverse(char* str)
{

if (NULL==str)return -1;
int l=strlen(str)-1;
if (1==l)return 1;

for(int x=0;x < l;x++,l--)
{
str[x]^=str[l];
str[l]^=str[x];
str[x]^=str[l];
}

return 0;

}


Is this right for reversing a string?


0

Response Number 2
Name: elric
Date: December 24, 2004 at 21:07:27 Pacific
Reply:

G'day,

Why are you asking us? Have you run it? What does it do?
I don't know much about C++ , but I would think that you need a graphics function (a la gotoxy in C) that places the start point of your text at a known point on the screen.
Then you would perhaps construct a loop that increments the "x" axis of this function by one each time. This will move the string across the screen, but depending on what result you require, you might have to change the increment or even put in delays (pause function) to get the "effect" that you want.
regards,
Elric


0

Response Number 3
Name: BlueRaja
Date: December 25, 2004 at 18:38:54 Pacific
Reply:

There are a thousand ways to do this, depending on how you want it to look and how you want to implement it...
Are you trying to do this in the console or in Windows?
If it's the former, should the current text stay on the screen and the message scrolls across a specific line, or do you want to clear everything and display the message every frame? What functions are you allowed to use (I'm assuming this is an assignment)? Can you use interrupts (Although that's probably a little too low-level...)?
If it's the latter, do you want to do it with or without MFC? Should it scroll inside a window, or across the entire screen (no matter what window is currently active)? Again, what functions are you allowed to use?

If you want us to do your homework for you, you'll have to give us more information about the assignment before we can tell you "Look in your book, we're not going to do this for you." ^_^

BlueRaja.admin@gmail.com


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Help in C++

Need help in C program... www.computing.net/answers/programming/need-help-in-c-program/4193.html

I need help in c plzzz www.computing.net/answers/programming/i-need-help-in-c-plzzz/529.html

Help in C Prog www.computing.net/answers/programming/help-in-c-prog/891.html