Link to home
Start Free TrialLog in
Avatar of Troudeloup
Troudeloup

asked on

{ENTER}


#include <iostream>

using namespace std;


int main ()
{
      
      string string1 = "{ENTER}";

      if ( string1[0] == "{" )
      {
            // so forth
      }
      
      
      
      
      
      return 0;
      
      
}





how do I make it work?

I just need to compare the n th char with a " // some string " 


i don't know, is this the way things are done in c++?
SOLUTION
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Troudeloup
Troudeloup

ASKER

     if ( string1[0] == "{" )



pops


test2.cpp:11: error: ISO C++ forbids comparison between pointer and integer




I need to know what the first character is in the string, so I used a if, but it's not allowed becaus I am comparing different type


thank you for cuing me to rephrase, I thought it was ok.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of evilrix
evilrix
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial