Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C by stas ( 16 years ago )
#include <iostream.h>
#include <stdlib.h>
#include <math.h>
#include <conio.h>
#include <stdio.h>

int main()
{
        int a[100]; int b[100];
        int n;

        cout<<"\n Vvedite kol-vo el-ov v massive: ";
        cin >> n;

        for (int i = 0; i < n; i++)
        {
                a[i] = rand() % 100 - 50;
                cout << a[i] << " ";
        }
        int j = 0;
        for (int i = 0; i < n; i += 2)
        {
                b[j] = a[i];
                j++;
        }

        cout<<"\n Ydaleni vse el-ty s ne4etnymy indexami: \n";
        for (int j = 0; j <= (n / 2); j++)
        cout<<b[j]<<" ";

        int index;int new_element;
        cout<<"\n Vvedite nomer v massive:";
        cin>>index;
        cout<<" Vvedite novyu element:";
        cin>>new_element;

        {a[index]=new_element;}

        cout<<"\n V massiv dobavlen element: ";
        for (int i=0;i<n;i++)
        cout<<a[i]<<" ";

        int i=0; int j=0;
        for (int i=n-1;i>=0;i--)
        {b[j]=a[i]; j++;}

        cout<<"\n Massiv perevernyt: ";
        for (int j=0;j<n;j++)
        cout<<b[j]<<" ";

 

Revise this Paste

Your Name: Code Language: