Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- using namespace std;
- void shop();
- void tablitsa();
- void fibonacci();
- int main(){
- int menu;
- while (1){
- cout << "Select of menu item: \n";
- cout << " 1 - Table \n 2 - Shop \n 3 - Fibonacci numbers\n 4 - Exit\n";
- cout << ">>";
- cin >> menu;
- switch(menu){
- case 1: system("cls"); tablitsa(); cout << "\n\n"; break;
- case 2: system("cls"); shop(); cout << "\n\n"; break;
- case 3: system("cls"); fibonacci(); cout << "\n\n"; break;
- case 4: return 0;
- default: cout << "Wrong number\n";
- }
- }
- return 0;
- }
- void fibonacci(){
- int N;
- cout << "Enter the numbers of Fibonacci numbers: ";
- cin >> N;
- int F[N];
- F[0] = 0;
- F[1] = 1;
- for (int i = 0; i<N; i++){
- F[i+2] = F[i] + F[i+1];
- cout << F[i] << " ";
- }
- }
- void tablitsa(){
- int levo=0;
- while (levo <= 1 || levo >= 9) {
- cout << "Enter the left number: ";
- cin >> levo;
- if (levo >= 1 && levo <= 9) {
- for (int i = 1; i < 11; i++) {
- cout << levo << "X" << i << " = " << levo * i << endl;
- }
- break;
- }
- }
- }
- void shop(){
- double i = 1, summ = 0, summ1 = 0, su = 0;
- while (i==1) {
- cout << "Enter your summ: ";
- cin >> summ;
- if (summ >= 3000) {
- summ1 = summ / 100 * 20;
- summ1 = summ - summ1;
- cout << "You have to pay " << summ1 << endl;
- su += summ1;
- }
- else {
- if (summ >= 1000) {
- summ1 = summ / 100 * 10;
- summ1 = summ - summ1;
- cout << "You have to pay " << summ1 << endl;
- su += summ1;
- }
- else {
- summ1 = summ - summ1;
- cout << "You have to pay " << summ << endl;
- su += summ;
- }
- }
- cout << "Press '1' if someone here" << endl;
- cin >> i;
- }
- cout << "Total on the day: " << su << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement