This file contains 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<< "Enter the radius of a circle:"; | |
int a; | |
cin >> a; | |
double b=3.1415926535; |
This file contains 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() { | |
// test the rand() function a few times | |
cout << rand() << "\n" | |
<< rand() << "\n" |
This file contains 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() { | |
// finding the maximum of two numbers | |
int num1, num2; | |
cout << "Enter two numbers: "; | |
cin >> num1 >> num2; |
This file contains 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 score1, score2; | |
// collect score 1 | |
cout << "Enter your score on the first exam (0 - 100): "; | |
cin >> score1; |
This file contains 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() { | |
double b; | |
cout << "Please enter a base number: "; | |
cin >> b; | |
int e; |
This file contains 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; | |
void print_rect(int, int); // we declare the function here | |
int main() { | |
int w, h; | |
// We generally prompt the user for input in the main function |
This file contains 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_bold(string); | |
int main() { | |
string test1 = "To <b>succeed</b> in <b>life</b> one must be <b>bold</b>!"; | |
cout << extract_bold(test1) << endl; |
This file contains 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
a. 10 | |
b. 10 | |
c. 10 | |
d. 21 | |
e. infinite loop | |
f. 11 | |
g. 7 |
This file contains 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
/* | |
This code is based on the first solution I posted for exercise 4 from Week 6. I placed a MODIFIED comment anywhere I changed the code. | |
*/ | |
#include <iostream> | |
#include <vector> | |
using namespace std; | |
vector<string> extract_bold(string); |
This file contains 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 <vector> | |
using namespace std; | |
void remove(vector<int>&, int); | |
void print(const vector<int>&); | |
int main() { | |
vector<int> v; |
OlderNewer