what if

This is a discussion on what if within the C++ Programming forums, part of the General Programming Boards category; Ok hello everyone I have a little question today, Well If i need an information that is necessary in capital ...

  1. #1
    I'm less than sure.... abyssphobia's Avatar
    Join Date
    Aug 2004
    Posts
    112

    what if

    Ok hello everyone
    I have a little question today,
    Well If i need an information that is necessary in capital letter but I dont want to mess with the user how I can make(is there something to do that) that the user write that dont matter is it in lower case or upper case.
    well my bf tell me how to do that in visual basic

    Code:
    if x = ucase("a") -> x = "A"
    but I dont have any idea, thx in adv.
    regards,
    Abyss


    well Im using Dev C++
    Last edited by abyssphobia; 10-12-2004 at 12:51 AM.
    Have I crossed the line?

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Hm... something like isupper, or islower? Or perhaps toupper and tolower.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    I think what you are looking for.. are the tolower() and toupper() functions.. located in the <cctype> library


    Code:
    #include<iostream>
    #include<cctype>
    using namespace std;
    
    int main()
    {
    
         char choice;
    
         cout << "Enter menu choice: ";
    
         cin >> choice;
    
              switch(toupper(choice))   //turns all user entries to upper case
              {
    
                        case 'A':  function_call();
                        break;
    
                        case 'E':  cout << "Bye";
                        exit(0);
             }
    
    return 0;
    }
    Last edited by The Brain; 10-12-2004 at 01:06 AM.
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  4. #4
    I'm less than sure.... abyssphobia's Avatar
    Join Date
    Aug 2004
    Posts
    112
    Thanx Quzah you have the idea, and thx anonytmouse ( http://www.cprogramming.com/fod/toupper.html )and great example the brain, yeah thats what I want , your example make that more clear.
    Last edited by abyssphobia; 10-12-2004 at 01:05 AM.
    Have I crossed the line?

Popular pages Recent additions subscribe to a feed

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