Thread: variables

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    9

    Question variables

    I am making a program, I am using alot of IF things--llke
    IF (x==2)
    and so on.

    I need to know how to set a letter to an if--like
    IF (x==L)
    or something like that, I need to know how to assign a letter to a
    variable.

  2. #2
    Unregistered
    Guest
    enclose the letter or symbol in single quotes

    char ch;
    if(ch == '*')
    {cout << "sing starry starry night" << endl;}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. basic question about global variables
    By radeberger in forum C++ Programming
    Replies: 0
    Last Post: 04-06-2009, 12:54 AM
  2. Best way to avoid using global variables
    By Canadian0469 in forum C++ Programming
    Replies: 7
    Last Post: 12-18-2008, 12:02 PM
  3. Replies: 15
    Last Post: 09-30-2008, 02:12 AM
  4. esbo's data sharing example
    By esbo in forum C Programming
    Replies: 49
    Last Post: 01-08-2008, 11:07 PM
  5. Global Variables
    By Taka in forum C Programming
    Replies: 34
    Last Post: 11-02-2007, 03:25 AM