Thread: Plz help wit my program

  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    2

    Plz help wit my program

    Whenever I try to compile this it says:
    Undefined symbol 'Hello' in function main()

    Code:
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
      char letter;
    
      cout<<"Please say Hello.\nSay: ";
      cin>>letter;
      
      if ( letter == Hello ) {
         cout<<"Thank you!\n\nPress Enter To Exit!";
      }
      else if ( letter != Hello ) {
         cout<<"I said Say Hello, Damnit!!\n\nPress Enter To Exit, NOW!!";
      }
      
      cin.get();
    }

  2. #2
    Slave MadCow257's Avatar
    Join Date
    Jan 2005
    Posts
    735
    put quotes around hello
    this is not going to work anyways though
    You will want to make letter a string

  3. #3
    Registered User
    Join Date
    Mar 2006
    Posts
    2
    ok tell me what it should look like plz

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    http://faq.cprogramming.com/cgi-bin/...&id=1043284385
    Use the second example and put quotes around your Hello.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    Slave MadCow257's Avatar
    Join Date
    Jan 2005
    Posts
    735
    here's a string example

    Code:
    #include <iostream>
    #include <string>
    
    using namespace std;
    
    int main()
    {
    	string letters;
    	cout<<"Please say Hello.\nSay: ";
    	cin>>letters;
    	if ( letters == "Hello" ) {
    		cout<<"Thank you!\n\nPress Enter To Exit!";
    	}
    	else if ( letters != "Hello" ) {
    		cout<<"I said Say Hello!!\n\nPress Enter To Exit, NOW!!";
    	}
    	cin.get();
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  2. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  3. Need help with my program...
    By Noah in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 07:49 PM
  4. Help Write This Program Plz
    By Unregistered in forum C++ Programming
    Replies: 3
    Last Post: 10-13-2001, 01:08 AM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM