Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Zadanie 1.:
- // ConsoleApplication2.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <new>
- int main()
- {
- int i = 0;
- try {
- for (;;i++) {
- int * tablica = new int[100000];
- }
- }
- catch (const std::bad_alloc& e) {
- std::cout <<i ;
- }
- system("pause");
- }
- Zadanie 2.:
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- int *tablica;
- int length = 0;
- int main(int argc, char** argv) {
- for (int p=0;; p++)
- {
- //powyższe może być np. jako zmienne globalne...
- int *buff = new int[length];
- for (int i = 0; i < length; i++)
- buff[i] = tablica[i];
- tablica = new int[length + 1];
- for (int i = 0; i < length; i++)
- tablica[i] = buff[i];
- //tablica[length]=Edit1->Text;
- delete[]buff;
- length++;
- cin >> tablica[p];
- }
- delete[]tablica;
- system("pause");
- return 0;
- }
- Zadanie 3.:
- // ConsoleApplication2.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- int main(int argc, char** argv) {
- double *tablica1;
- double *tablica2;
- double *tablica3;
- tablica1 = new double[20];
- tablica2 = new double[20];
- tablica3 = new double[20];
- for (int i = 0; i < 20; i++)
- {
- tablica1[i] = rand();
- tablica2[i] = rand();
- tablica3[i] = tablica1[i] * tablica2[i];
- cout << tablica1[i] << " " << tablica2[i] << " " << tablica3[i] << endl;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement