scrolling text problem

This is a discussion on scrolling text problem within the C++ Programming forums, part of the General Programming Boards category; welll i am wondering how i should determine the lenght of the charecter the user inputs... here is waht i ...

  1. #1
    Unregistered
    Guest

    scrolling text problem

    welll i am wondering how i should determine the lenght of the charecter the user inputs... here is waht i have uup to date lol... this problem is hard....

    Code:
    #include <iostream>
    
    using namespace std;
    
    //------------------------------------------------------------------------------------------------
    char GetArray()
    {
    	char text;
    
    	cout<<"Enter the string to scroll now:";
    	cin.getline ( text, TEXTLEN );//hmmm this is where i have to make it a variable :D
    }
    //------------------------------------------------------------------------------------------------
    int main()
    {
    	GetArray();
    
    	return (0);
    }

  2. #2
    I'm Back
    Join Date
    Dec 2001
    Posts
    556
    >>welll i am wondering how i should determine the lenght of the charecter the user inputs...<<

    it depends on what you want to enter

    name: 30
    sex: 1
    month: 10
    paragraph: 80 or more

  3. #3
    Unregistered
    Guest
    nono what i want to is here ill show you

    Code:
                    const int MAXLENGHT=50;
    	char word[MAXLENGHT];
    	
    	cout<<"Enter the suspected palindrome: ";
    	cin.getline(word,MAXLENGHT);
    
    	return (0);
    so lets say they enter 2002
    well then how would i know that word is only filled until [3]? thats what i want to know how to do!

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >char text;
    Be sure to change this to a char * or char array before you try to read a stream of characters into it.

    >how would i know that word is only filled until [3]?
    Actually, it's filled to [4] when you take into account the null terminator. But to get the length of the actual input, there's a C string function called strlen that should be what you want.

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problem with text files
    By Gather in forum C++ Programming
    Replies: 27
    Last Post: 06-05-2006, 04:16 PM
  2. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  3. Scrolling text in a DOS CONSOLE box
    By Blizzarddog in forum C++ Programming
    Replies: 4
    Last Post: 04-06-2004, 02:27 PM
  4. Scrolling Text Boxes
    By minime6696 in forum Windows Programming
    Replies: 1
    Last Post: 11-30-2003, 08:42 AM
  5. Outputting String arrays in windows
    By Xterria in forum Game Programming
    Replies: 11
    Last Post: 11-13-2001, 06:35 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21