Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void Welcome()
- {
- cout << "Welcome to Vinyl Scratch's MathFinder!\r\n";
- cout << "It's my first C++ program, so I wanted to see if you guys liked it, and if I did well.\r\n\r\n\r\n";
- }
- int main()
- {
- unsigned long Width, Height, Base, Width2, Length2;
- Welcome();
- enum mathType {Area, Volume, Perimeter};
- mathType Math;
- int x;
- cout << "What math type would you like?(0-2) Area is 0, Volume is 1, and Perimeter is 2.\r\n";
- cin >> x;
- Math = mathType(x);
- if (Math == Area)
- {
- if (!cin.good())
- {
- cout << "Invalid Character, please input an integer.\r\n";
- return 1;
- }
- cout << "Enter Width then Length:" << "\r\n";
- cin >> Width;
- cin >> Height;
- cout << "Area is:" << Width * Height << endl;
- }
- if (Math == Volume)
- {
- if (!cin.good())
- {
- cout << "Invalid Character, please input an integer.\r\n";
- return 1;
- }
- cout << "Enter Width, then Height, then Base:\r\n";
- cin >> Width;
- cin >> Height;
- cin >> Base;
- cout << "Volume is:" << Width * Height * Base << endl;
- }
- if (Math == Perimeter)
- {
- if (!cin.good())
- {
- cout << "Invalid Character, please input an integer.\r\n";
- return 1;
- }
- cout << "Enter Width, then Length.\r\n";
- cin >> Width;
- cin >> Height;
- Width2 = Width * 2;
- Length2 = Height * 2;
- cout << "Perimeter is:" << Width2 + Length2 << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement