Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<conio.h>
- using namespace std;
- void fibo(){
- int prev,sum;
- cout<<"Please input staring point of fibonacci sequence: ";
- cin>>sum;
- for(int x=0;x<6;x++){
- prev = sum - prev;
- sum += prev;
- cout<<prev<<" ";
- }
- }
- void seats(){
- string select;
- string seat[3][5] = {
- {"a","aa","ab","ac","ad"},
- {"b","ba","bb","bc","bd"},
- {"c","ca","cb","cc","cd"}
- };
- cout<<"Please input what seat you will reserve: \n\n";
- for(int x=0;x<3;x++){
- for(int y=0;y<5;y++){
- cout<<"\t"<<seat[x][y]<<" ";
- }
- cout<<endl<<" \n";
- }
- cout<<"\n\n";
- cin>>select;
- for(int x=0;x<3;x++){
- for(int y=0;y<5;y++){
- if(seat[x][y] == select){
- seat[x][y] = "X";
- }cout<<"\t"<<seat[x][y]<<" ";
- }cout<<endl<<" \n";
- }
- cout<<"\n\nYour seat will now be reserved Thank you :) \n\n";
- }
- void assig(){
- int price_arr[5],quantity_arr[5],product_arr[5],total_price=0,total_quantity=0,temp=0;
- for(int x=0;x<5;x++){
- cout<<"Please input the prices: ";
- cin>>price_arr[x];
- cout<<"Please input the Quantity: ";
- cin>>quantity_arr[x];
- product_arr[x] = price_arr[x] * quantity_arr[x];
- total_price += product_arr[x];
- total_quantity += quantity_arr[x];
- }
- cout<<"total price is: "<<total_price;
- cout<<"\nTotal quantity is: "<<total_quantity;
- for(int x=0;x<5;x++){
- for(int y=0;y<4;y++){
- if(product_arr[y] >= product_arr[y+1]){
- temp = product_arr[y+1];
- product_arr[y+1] = product_arr[y];
- product_arr[y] = temp;
- }
- }
- }
- for(int x=0;x<5;x++){
- for(int y=0;y<4;y++){
- if(quantity_arr[y] <= quantity_arr[y+1]){
- temp = quantity_arr[y+1];
- quantity_arr[y+1] = quantity_arr[y];
- quantity_arr[y] = temp;
- }
- }
- }
- cout<<endl;
- for(int x=0;x<5;x++){
- cout<<product_arr[x]<<" ";
- }
- cout<<endl;
- for(int x=0;x<5;x++){
- cout<<quantity_arr[x]<<" ";
- }
- }
- void mi(){
- int ml;
- cout<<"Please enter amount of Milliliters: ";
- cin>>ml;
- ml = ml /500;
- cout<<"the total amount of containers are: "<<ml<<endl;
- }
- void arr(){
- int array_1 [10],x,y;
- cout<<"\n\tinput";
- for(x=0;x<10;x++){
- cin>>array_1[x];
- }
- for(y=0;y<10;y++){
- cout<<"Square of "<<array_1[y]<<" is "<<array_1[y]*array_1[y]<<endl;
- }
- }
- main(){
- int choice;
- cout<<"Please input to what program you want to initiate: \n";
- cout<<"[1] fibonacci [2] seats [3] prices& quantity [4]Mililiters [5]Square\n\n";
- cin>> choice;
- switch(choice){
- case 1:
- fibo();
- break;
- case 2:
- seats();
- break;
- case 3:
- assig();
- break;
- case 4:
- mi();
- break;
- case 5:
- arr();
- break;
- }
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement