Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL,"");
- srand(time(0));
- double *G = new double[14];
- for (int i=0;i<10;i++)
- G[i] = rand()%10;
- cout << "Исходный массив : \n";
- for (int i=0;i<10;i++)
- cout << G[i] << "\t";
- for (int i=0;i<10;i++)
- {
- if (i==0 || (i+1)%2!=0)
- {
- G[i] /= 10;
- }
- else G[i] = -G[i];
- }
- cout << "\nКонечный массив : \n";
- for (int i=0;i<10;i++)
- cout << G[i] << "\t";
- cout << endl;
- delete[] G;
- /*cout << endl << endl << endl; // proverka delete
- for (int i=0;i<10;i++)
- cout << G[i] << "\t";*/
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement