Thread: Couple of Questions...

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    97

    Couple of Questions...

    is there a random script in c++? i want a program to pick a number between 1 and 4(for example), then assign that to a certain variable. how would i do that?

    also, what is a variable that can hold more than 1 letter? i know there has to be one.....right?!

    THANX! also, please include easy to understand coding on each, some of u guys clubber it all together. thx

  2. #2
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    TRY THE FAQ.

    Look for the rand() function and learn about pointers, especially char ones.
    Do not make direct eye contact with me.

  3. #3
    Registered User
    Join Date
    Jun 2002
    Posts
    230
    also, what is a variable that can hold more than 1 letter?
    You can use an array of chars like
    char name[30] but that only read up until a space i BELIEVE.

    also use a string included in the string library

    string name;

    and use getline function to input the name.

    getline(cin, name, 30);
    C++ Rules!!!!
    ------------
    Microsoft Visual Studio .NET Enterprise

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Couple of simple directdraw questions.
    By Deo in forum Game Programming
    Replies: 3
    Last Post: 05-25-2005, 07:55 AM
  2. Studying for Final, Couple Questions...
    By stewade in forum C Programming
    Replies: 4
    Last Post: 05-10-2004, 05:02 PM
  3. A couple of Questions
    By johnnabn in forum C++ Programming
    Replies: 4
    Last Post: 02-24-2003, 10:10 PM
  4. A couple of PowerPoint questions.
    By sean in forum Tech Board
    Replies: 2
    Last Post: 01-27-2003, 05:26 AM
  5. New to C++/ Couple of questions...
    By danielthomas3 in forum C++ Programming
    Replies: 13
    Last Post: 04-14-2002, 03:46 PM