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; | |
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; | |
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() { | |
// 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> | |
#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(){ | |
cout<< "Enter the radius of a circle:"; | |
int a; | |
cin >> a; | |
double b=3.1415926535; |
NewerOlder