-
c++ strings
hey,
I'm trying to do the c++ style strings tutorial on this site but it's not working. Could it be because I'm using Dev c++?
here's my code:
Code:
#include <iostream.h>
#include <stdlib.h>
using namespace std;
int main()
{
string my_string;
return 0;
}
not realy sure why this won't work. Help would be apreciated, thanks
-
the program itself will not indicate to the user whether it's working or not.
the program simply declares a variable, then exits. any compiler errors?
Code:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string first_name;
string last_name;
cout << "Enter your first name: ";
cin >> first_name;
cout << "\n\nEnter your last name: ";
cin >> last_name;
cout << "\n\nYour full name is: " << first_name << " " << last_name;
cout << "\n\nYour initials are: " << first_name[0] << ". " << last_name[0] << ".";
return 0;
}
-
I just didn't include the right header, thanks