Limelight Forums

Full Version: Coding!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey there! Here are some programs that i have made on C++, still learning though. What programs have you made? Feel free to post them!

Code:
#include <iostream>

using namespace std;

int main()
{
    char x;
    int a; int b; int c; int m;
    cout << "Give a name." << endl;
    cin >> x;
    cout << "Give 3 Numbers." << endl;
    cin >> a >> b >> c;
    m=(a+b+c)/3;
    cout << "O mesos oros einai: " << m << endl;
    if (m<14)
    {
        cout << "Bad." << endl;
    }
    else if (m<14 && m>16)
    {
        cout << "Metrios." << endl;
    }
    else if (m>16 && m<18)
    {
        cout << "Good." << endl;
    }
    else if (m>18)
    {
        cout << "Perfect." << endl;
    }
    return 0;
}

Code:
#include <iostream>

using namespace std;

int main()
{
    int a; int b;
    char x;
    cout << "Dose 2 Arithmous." << endl;
    cin >> a >> b;
    cout << "Dose 1 epilogi." << endl;
    cin >> x;
    if (x=='P')
    {
        cout << "Epilogi: Prosthesi." << endl;
        cout << "Caculating..." << endl;
        cout << "Result: " << a+b << endl;
    }
    else if (x=='A')
    {
        cout << "Epilogi: Aferesi." << endl;
        cout << "Caculating..." << endl;
        cout << "Result: " << a-b << endl;
    }
    else if (x=='L')
    {
        cout << "Epilogi: Polaplasiasmos." << endl;
        cout << "Caculating..." << endl;
        cout << "Result: " << a*b << endl;
    }
    else if (x=='D')
    {
        cout << "Epilogi: Dieresi." << endl;
        cout << "Caculating..." << endl;
        cout << "Result: " << a/b << endl;
    }
    else
    {
        cout << "Invalid Parameter." << endl;
    }
    return 0;
}

What do you think?