Placeholder — Lesson 20: Introduction to Pointers, dereferencing, and references


#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



Lesson 20 -- Introduction to Objects (classes) and Constructors
Placeholder -- Lesson 21: Introduction to Classes / Object theory