#include <iostream>
using namespace std;

void enter(){
    cout << "\nPress Enter to continue."; 
    cin.get();
}

void aa(){
    system("clear");
    cout << "Display a number from 50 down to 30\n" << endl;
    for(int i=50; i>=30;i-=1){
        cout << i<<endl;
    }
    enter();
}
void bb(){
    system("clear");
    cout <<"Display a number starting from 0 to 100 \n with interval of 5" << endl;
    for(int i=0; i<=100;i+=5){
        cout << i<<endl;
    }
    enter();
}
void cc(){
    system("clear");
    int s=0;
    cout << "Display the sum of all number from 10 to 50"<<endl;
    for(int i=10; i<=50;i++){
        cout << s << " + " << i << " = " << (s+=i) << endl;
    }
    cout << "Total sum 10 to 50 is " << s <<endl;
    enter();
}
void dd(){
    system("clear");
    cout << "Good bye Boii" <<endl<<"Get the on https://pastebin.com/byzi6g85 ";
}
int main(){
    char x;
    while(x!='d'){
        system("clear");
        cout << "Main menu:"<<endl;
        cout <<"\t[a] Display a number from 50 down to 30"<<endl;
        cout <<"\t[b] Display a number from 0 to 100 by 5"<<endl;
        cout <<"\t[c] Display the sum of all number from 10 to 50"<<endl;
        cout <<"\t[d] Exit"<<endl;
        cout <<"Choose a Letter: ";
        cin >> x;
        cin.ignore(1000,'\n');
        
        switch(x){
            case 'A':
            case 'a':
                aa();
            break;
            case 'B':
            case 'b':
                bb();
            break;
            case 'C':
            case 'c':
                cc();
            break;
            case 'D':
            case 'd':
                dd();
            break;
            default:
                cout <<"\nInvalid choice."<<endl;
                enter();
        }
    }
    return 0;
}