Thread: strings

  1. #1
    Registered User
    Join Date
    Feb 2009
    Location
    Indiana
    Posts
    99

    strings

    I didnt include my code for my Stack on here. I want to say if string is not empty, then push each character onto stack. This isnt my whole code but just the part where Im stuck at. Do I have create a bool empty maybe?
    Code:
    int main(){
    
         Astack S;
         string s;
    
         cout <<"Enter data:";
         getline(cin, s);
    
         if(!s.empty){
             S.push(s);
           }

  2. #2
    Registered User
    Join Date
    Dec 2010
    Posts
    1
    hello,
    i have some problem about my project..
    can u help me to solve lcd.h function
    the problem is unable to locate the lcd.h...

  3. #3
    Registered User
    Join Date
    Feb 2009
    Location
    Indiana
    Posts
    99

  4. #4
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    Since "s" is a std::string then "empty" should be a function.

    Code:
    if(!s.empty()){

    Jim

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Strings Program
    By limergal in forum C++ Programming
    Replies: 4
    Last Post: 12-02-2006, 03:24 PM
  2. Programming using strings
    By jlu0418 in forum C++ Programming
    Replies: 5
    Last Post: 11-26-2006, 08:07 PM
  3. Problems with strings as key in STL maps
    By all_names_taken in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2006, 11:34 AM
  4. Reading strings input by the user...
    By Cmuppet in forum C Programming
    Replies: 13
    Last Post: 07-21-2004, 06:37 AM
  5. menus and strings
    By garycastillo in forum C Programming
    Replies: 3
    Last Post: 04-29-2002, 11:23 AM