Programowanie zjazd VIII 15.01.2011, Programowanie w c++, c++ 2

[ Pobierz całość w formacie PDF ]
#include <iostream>#include <ctime>using namespace std;const char f = char(219);const char e = ' ';void drukuj(char k[5][5]){for (int i=0; i<5; i++){for (int j=0; j<5; j++){cout << k[i][j];}cout << endl;}}int main(){char klocki[][4][5][5] ={{{{f,f,f,f,f},{f,e,e,e,f},{f,e,e,e,f},{f,f,f,f,f},{f,e,e,e,f}},{{f,f,f,f,f},{e,f,e,e,f},{e,f,e,e,f},{e,f,e,e,f},{f,f,f,f,f}},{{f,e,e,e,f},{f,f,f,f,f},{f,e,e,e,f},{f,e,e,e,f},{f,f,f,f,f}},{{f,f,f,f,f},{f,e,e,f,e},{f,e,e,f,e},{f,e,e,f,e},{f,f,f,f,f}}}};drukuj(klocki[0][0]);cout << endl;drukuj(klocki[0][1]);cout << endl;drukuj(klocki[0][2]);cout << endl;drukuj(klocki[0][3]);cout << endl;}#include <iostream>#include <ctime>using namespace std;const char f = char(219);const char e = ' ';void drukuj(char k[5][5]){for (int i=0; i<5; i++){for (int j=0; j<5; j++){cout << k[i][j];}cout << endl;}}int main(){char klocki[][4][5][5] ={{{{f,f,f,f,f},{f,e,e,e,f},{f,e,e,e,f},{f,f,f,f,f},{f,e,e,e,f}},{{f,f,f,f,f},{e,f,e,e,f},{e,f,e,e,f},{e,f,e,e,f},{f,f,f,f,f}},{{f,e,e,e,f},{f,f,f,f,f},{f,e,e,e,f},{f,e,e,e,f},{f,f,f,f,f}},{{f,f,f,f,f},{f,e,e,f,e},{f,e,e,f,e},{f,e,e,f,e},{f,f,f,f,f}}}};int index = 0;drukuj(klocki[0][index]);cout << endl;index = 7%4;drukuj(klocki[0][index]);cout << endl;}#include <iostream>#include <ctime>using namespace std;const char f = char(219);const char e = ' ';void drukuj(char k[5][5]){for (int i=0; i<5; i++){for (int j=0; j<5; j++){cout << k[i][j];}cout << endl;}}void wstaw(char plansza [][25], int r, int c, char k[][5]){for (int i=0; i<5; i++){for (int j=0; j<5; j++){plansza[r+i][c+j] = k[i][j];}cout << endl;}}void drukujPlansza(char plansza[][25]){for (int i=0; i<5; i++){for (int j=0; j<5; j++)cout << plansza[i][j] == 0 ? ' ' : plansza[i][j];cout << endl;}}int main(){char klocki[][4][5][5] ={{{{f,f,f,f,f},{f,e,e,e,f},{f,e,e,e,f},{f,f,f,f,f},{f,e,e,e,f}},{{f,f,f,f,f},{e,f,e,e,f},{e,f,e,e,f},{e,f,e,e,f},{f,f,f,f,f}},{{f,e,e,e,f},{f,f,f,f,f},{f,e,e,e,f},{f,e,e,e,f},{f,f,f,f,f}},{{f,f,f,f,f},{f,e,e,f,e},{f,e,e,f,e},{f,e,e,f,e},{f,f,f,f,f}}}};int index = 0;drukuj(klocki[0][index]);cout << endl;index = 7%4;drukuj(klocki[0][index]);cout << endl;char plansza[200][25] = {0};wstaw(plansza,0,5,klocki[0][0]);drukujPlansza(plansza);}#include <iostream>#include <ctime>using namespace std;int main(){int a= 10;int *r = &a;int **y = &r;cout << a << endl<< &a << endl<< r << endl<< *r << endl<< &r << endl<< y << endl<< *y << endl<< **y << endl<< &y << endl;**y = 22;cout << a << endl;}#include <iostream>#include <ctime>using namespace std;void swap(float *a, float *b){float temp=*a;*a = *b;*b = temp;}int main(){float x = 20, y =10;swap(x,y);cout << x << y << endl;}#include <iostream>#include <ctime>using namespace std;void swap(float *a, float *b){float temp=*a;*a = *b;*b = temp;}int main(){float x = 20, y =10;int *t;while (true){t=new int;}//swap(x,y);//cout << x << y << endl;}#include <iostream>#include <ctime>using namespace std;void swap(float *a, float *b){float *temp=a;a = b;b = temp;}int main(int argc, char* argv[]) //liczba argumentow, lancuch string{for (int i=0; i<argc; i++){cout << argv[i] << endl;}} [ Pobierz całość w formacie PDF ]