[spoiler title=”Lesson Video”]
Direct Download of Video (For mobile / offline viewing)(right click > save target as)


[/spoiler]

[spoiler title=”Lesson Source Code”]
#include
#include

using namespace std;

int main(){

//”Hello World”
//Get strings with spaces
//Compare Strings
//Show in debugger
//”Chars” and strings
string str = “”, str2 = “”;
cout << "Enter a string: "; //cin >> str; //Breaks on whitespace, this is WRONG
getline(cin, str);

cout << "Enter a Second string: "; //cin >> str; //Breaks on whitespace, this is WRONG
getline(cin, str2);

/*if ( str[0] == ‘H’ ){
cout << "H Found" << endl; }*/ //str = BBB //str2 = AAA // A < B if (str.compare(str2) < 0){ cout << "str: " << str << " is before str2 in the alphabet: " << str2; } if (str.compare(str2) > 0){
cout << "str: " << str << " is after str2 in the alphabet: " << str2; } if (str.compare(str2) == 0){ cout << "str: " << str << " is Equal To : " << str2; } cout << endl; system("PAUSE"); return 0; } [/spoiler] Homework: None



[spoiler title=”Lesson Video”]
Direct Download of Video (For mobile / offline viewing)(right click > save target as)


[/spoiler]

[spoiler title=”Lesson Source Code”]
#include
#include

using namespace std;

int main(){

//”Hello World”
//Get strings with spaces
//Compare Strings
//Show in debugger
//”Chars” and strings
string str = “”, str2 = “”;
cout << "Enter a string: "; //cin >> str; //Breaks on whitespace, this is WRONG
getline(cin, str);

cout << "Enter a Second string: "; //cin >> str; //Breaks on whitespace, this is WRONG
getline(cin, str2);

/*if ( str[0] == ‘H’ ){
cout << "H Found" << endl; }*/ //str = BBB //str2 = AAA // A < B if (str.compare(str2) < 0){ cout << "str: " << str << " is before str2 in the alphabet: " << str2; } if (str.compare(str2) > 0){
cout << "str: " << str << " is after str2 in the alphabet: " << str2; } if (str.compare(str2) == 0){ cout << "str: " << str << " is Equal To : " << str2; } cout << endl; system("PAUSE"); return 0; } [/spoiler] Homework: None