This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
cout << "You wake up to find yourself in the entry hall of a mansion. " | |
"There are two doors in the hall, one leading outside, another " | |
"leads further into the mansion.\n" | |
"\t1) Go outside\n" | |
"\t2) Go further into the mansion\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdlib> | |
using namespace std; | |
int main() { | |
// What would happen if we replaced time(0) here with a number, like 2? | |
srand(time(0)); | |
// The two question marks below mean that you should figure out the correct |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
int user_input = 0; | |
cout << "Please enter a number: "; | |
cin >> user_input; | |
if (user_input <= 1) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
string name; | |
cout << "Please enter your first name: "; | |
cin >> name; | |
int i = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
string fruit; | |
cout << "Please enter a fruit: "; | |
cin >> fruit; | |
while (!(fruit == "apple" || fruit == "orange" || fruit == "pineapple")) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Example field (aka columns) names and values, that will be used in the | |
* CAML query. The values are the attributes of a single list item here. | |
* If the field name contains a space in SharePoint, replace it | |
* here with _x0020_ (including underscores). | |
*/ | |
$field1Name = "Name"; | |
$field2Name = "Email"; | |
$field3Name = "PhoneNumber"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (result <= 10) { | |
handling(); | |
} else if (result > 10) { | |
otherHandling(); | |
} else { | |
handling(); // to be sure | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
/** | |
* @brief Extracts the name out of a greeting. | |
* | |
* For example, given the input "Hello, my name is John.", this function should | |
* return "John". Exclamatory statements should work as well ("... is John!"). | |
* Also, any greeting may be used, ex: "Grettings fellow, my name is John!" will |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
string name = "Johnnie Appleseed's Amazing Fruit Stand!"; | |
// What does each of these print out? | |
cout << name.find("Johnnie") << endl; | |
cout << name.find("s") << endl; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
string extract_bolds(string input) { | |
string result; | |
string working = input; | |
while (working.find("<b>") != -1 && working.find("</b>") != -1) { | |
int first = working.find("<b>") + 3; |