ascii and pointer trouble!!!

This is a discussion on ascii and pointer trouble!!! within the C++ Programming forums, part of the General Programming Boards category; My friend wanted me to create a little programme that he can access but the teachers can't, using commands (because ...

  1. #1
    yes, I'm registered!!! algi's Avatar
    Join Date
    Nov 2004
    Location
    Ipswich
    Posts
    161

    ascii and pointer trouble!!!

    My friend wanted me to create a little programme that he can access but the teachers can't, using commands (because everything you do on the computers is tracked,) so I created the source code below but there is a problem with pointers and ASCII but I dont understand what the problem is!!! Please Help

    #include <iostream>

    using namespace std;

    void seatingplans();

    int main()
    {

    int command;

    cout<<"\n\n\n\n\n";
    cout<<" ****************************\n";
    cout<<" * * * ******* *\n";
    cout<<" * * * * *\n";
    cout<<" * ******** * *\n";
    cout<<" * * * * *\n";
    cout<<" * * * ******* *\n";
    cout<<" * *\n";
    cout<<" ****************************\n\n";
    cout<<" Press ENTER to continue! \n\n\n\n\n\n";

    cin.ignore();

    cout<<" ****************************\n";
    cout<<" * * * * * *\n";
    cout<<" * * * * * *\n";
    cout<<" * * * * * * *\n";
    cout<<" * * *** * * *\n";
    cout<<" * * * * *\n";
    cout<<" * *\n";
    cout<<" ****************************\n\n";
    cout<<" Property of Alex Pajak 2004 \n\n";
    cout<<" Press ENTER To continue\n\n\n\n\n\n\n";

    cin.ignore();

    cout<<"Please enter a VALID server command!\n\n";
    cout<<"Command: ";
    cin>>command;
    cin.ignore();

    if ( command == "red27" ) //Problem 1
    {
    seatingplans();
    }
    }

    void seatingplans()
    {

    int lesson;

    cout<<"Please enter the lesson which you wish to view a seating plans for\n\n";
    cin>>lesson;
    cin.ignore();

    cout<<"Lesson: ";
    if ( lesson == "Geography" ) //Problem 2
    {

    cout<<"Below is the Geography seating Plan:\n\n";
    }

    else {
    cout<<"Sorry The seating plan for " << lesson << " cannot be found!";
    }
    }

    Thanks in Advance

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    >int command;
    If you want to store text, use:
    string command;

    >int lesson;
    Same here:
    string lesson;

    Make sure to:
    #include <string>

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pointer array's and ASCII to bit conversion
    By AdamLAN in forum C++ Programming
    Replies: 12
    Last Post: 05-06-2005, 06:55 PM
  2. Encrypting text file with ASCII hex
    By supaben34 in forum C++ Programming
    Replies: 1
    Last Post: 03-24-2005, 06:35 PM
  3. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM
  4. ascii values for keys
    By acid45 in forum C Programming
    Replies: 2
    Last Post: 05-12-2003, 08:13 AM
  5. Replies: 5
    Last Post: 10-29-2001, 10:16 AM

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