Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- #define MAX_SIZE 70
- int main()
- {
- int v[MAX_SIZE];
- int n;
- cout << "Introdu n (mai mic decat " << MAX_SIZE << ": ";
- cin >> n;
- int a;
- //Inserare
- for (int i = 0; i < n; i++)
- {
- cout << "Introdu valoare: ";
- cin >> a;
- v[i] = a;
- }
- //Afisare
- for (int i = 0; i < n; i++)
- {
- cout << v[i] << " ";
- }
- cout << endl;
- cout << "Mai introdu un numar: ";
- cin >> a;
- v[n] = a; // Inseram pe ultima pozitie
- n++; //Incrementam numarul de elemente imediat dupa
- //Afisare
- for (int i = 0; i < n; i++)
- {
- cout << v[i] << " ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment