Need help with strings and coloring text fast, please.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Andy011
    New Member
    • Nov 2006
    • 2

    Need help with strings and coloring text fast, please.

    Hi, I wanna know how to avoid the program to scan only the first letter of a string... I know it sounds real n00bish, but if you could post a simple example (SIMPLE, not like the help menu from c++) through C++ it'd be awesome :D.

    Also, I would like to know how to color a text (What library should be used, how do you use a variable to color the text, and so on...).


    P.S: The reason I need it fast is because I need to deliver a work tomorrow at college (about 30% of the total grade).

    Thanks a lot in advanced. :)
  • sivadhas2006
    New Member
    • Nov 2006
    • 142

    #2
    Hi,

    To skip the character use the following function.

    Code:
    getch()
    To print the colorful text use the following functions.

    Code:
    textcolor(WHITE); and 
    cprintf("Colored Text")
    Regards,
    M.Sivadhas.

    Comment

    • QryS
      New Member
      • Nov 2006
      • 3

      #3
      I wanna know how to avoid the program to scan only the first letter of a string...

      Hi
      try
      #include<iostre am.h>

      void main()
      {
      char str[10];
      cout<<"\n Enter name";
      cin.getline(str ,10);
      cout<<str;
      }
      It will alow you to enter 9 char because last char in array has to be \0. User can enter more letters on the screen but only first 9 will be in str. You can vary second argument of getline() which is no of char you want to enter remember to change str to the same number or bigger.
      good loock

      Comment

      • Andy011
        New Member
        • Nov 2006
        • 2

        #4
        Thanks you guys ^^ That helped a lot :)

        Comment

        Working...