variables

This is a discussion on variables within the C++ Programming forums, part of the General Programming Boards category; I am making a program, I am using alot of IF things--llke IF (x==2) and so on. I need to ...

  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, 11:02 AM
  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, 10:07 PM
  5. Global Variables
    By Taka in forum C Programming
    Replies: 34
    Last Post: 11-02-2007, 03:25 AM

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