Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions Computer Science Project 2/Computer Science Project 2/it works now
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#include <iostream> // gives access to cin, cout, cnd1, <<, >>, boolalpha, noboolalpha
#include <conio.h> // gives access to _kbhit() and _getch() for pause()
#include <math.h> // power function pow
// Namespaces
using namespace std; //*
// Functions()
void pause() {
cout << "Press any key to continue . . .";
while (!_kbhit());
_getch();
cout << '/n';
}
// MAIN
void main() {
// Variables
int potato = 0;
float tomato = 0;
double tomatoes = 0;
bool beet_root = false; // assume no one has beet roots
char frisk;
int calc_1 = 0, calc_2 = 0, calc_3 = 0;

// User Queries
cout << "How many potatoes do you have? ";
cin >> potato; //int
cout << "How much tomato sauce doesthe recipe call for in ounces? ";
cin >> tomato; // float?
cout << "How many tomatoes do you think exist on the planet in mols? ";
cin >> tomatoes;
cout << "Do you have a beet root : Y/N ";
cin >> frisk;
if (frisk == 'Y' || frisk == 'y') {
beet_root = true; // freely changes the value from false to true
}

// Print out stored data
cout << "You have " << potato << "number of potatoes. \n";
cout << "You need " << tomato << " ounces of tomato sauce for your recipe." << endl;
cout << "You think approximately " << tomatoes * 6.022 * pow(10.0, 23) << "tomatoes exist on the earth." << '\n';
cout << boolalpha << "The answer evaluation of you have beet root is " << beet_root << endl;

// Change Values

cout << "2";
cin >> calc_1;
cout << "1";
cin >> calc_2;
cout << calc_1 << " + " << calc_2 << "=" << calc_1 + calc_2 << endl;
calc_3 = calc_1 * calc_2;
cout << calc_1 << "*" << calc_2 << "=" << calc_3 << endl;
// Pause
pause();
}