Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cstdlib> //system
- using namespace std;
- float calculateArea(float l, float w);
- void area();
- void baydin();
- void menu();
- int main()
- {
- while (1)
- {
- system("cls");
- menu();
- }
- return 0;
- }
- void menu()
- {
- int ans = -999;
- cout << "Menu System" << endl;
- cout << "=============" << endl;
- cout << "1 - Baydin" << endl;
- cout << "2 - Calculate Area " << endl;
- cout << "3 - Exit Program" << endl;
- cout << "Please choose 1,2,3: ";
- cin >> ans;
- switch (ans)
- {
- case 1: baydin(); break;
- case 2: area(); break;
- case 3: exit(0); break;
- default: break;
- }
- }
- void area()
- {
- float length = 0.0F;
- float width = 0.0F;
- float area = 0.0F;
- cout << "Enter Length ";
- cin >> length;
- cout << " Enter Width ";
- cin >> width;
- area = calculateArea(length, width);
- cout << "The area is " << area << endl;
- system("pause");
- }
- float calculateArea(float l, float w)
- {
- return w * l;
- }
- void baydin()
- {
- string name = "";
- int sum = 0;
- int luck = -999;
- cout << "Please Enter Your Name: ";
- cin >> name;
- for (char ch : name)
- {
- sum += int(ch);
- }
- luck = sum % 3;
- if (luck == 0)
- {
- cout << "bad" << endl;
- }
- if (luck == 1)
- {
- cout << "normal" << endl;
- }
- if (luck == 2)
- {
- cout << "excellent" << endl;
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement