Untitled

 avatar
unknown
c_cpp
2 years ago
1.2 kB
4
Indexable
#include <iostream>

using namespace std;

int main()
{
    int x = 5; //int = numar intreg
    float y = 1.23; // float = numar real 1.000000
    double z = 2.5231321; // double = numar real, precizie mai mare decat float
    char c = 'c'; // un singur caracter
    long long a = 1231232132131; // numar intreg, poate stoca valori mai mari decat int
    unsigned int b = 100; // numar intreg, pozitiv, poate stoca valori pozitive mai mari decat int
    bool d = 0; // boolean, are doar 2 valori: true (1), false (0)

    int f = 9;

    // structura liniara
    x = x + 1;
    x++;
    x = x + 5;
    x += 5;

    // structura conditionata
    if (x == 4) {
        x = 10;
    }
    else if ((!(x == 9) or (x != 5)) and y > 0) {
        x = 2;
    }

    if (x != 9) {

    }
    else {

    }

    // structuri repetitive

    /*for (int i = 1; i <= 5; i++) {
        f++;
    }

    int i = 1;
    while (i <= 5) {
        f++;

        i++;
    }

    i = 1;
    do {
        f++;
    } while (i <= 5);*/

    cin >> a;

    cout << c << " " << a << endl;
    cout << f;
    return 0;
}
Editor is loading...