Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- char screen[25][80];
- int** array = NULL;
- int amount = 0;
- int search(int inputNumber);
- void window(int numaber);
- int main(){
- for(int i = 0; i < 25; ++i){
- for(int j = 0; j < 80; ++j){
- screen[i][j] = '.';
- }
- }
- cin >> amount;
- array = new int*[amount]; // инициализация работает
- for(int i = 0; i < amount; ++i){
- array[i] = new int[6];
- for(int j = 0; j < 6; ++j){
- array[i][j] = 0;
- }
- }
- cout << "Initiationg array assignment" << endl;
- for(int i = 0; i < amount; ++i){ //считывание работает
- int lim = 6;
- cin >> array[i][0];
- if(array[i][0] == 0){
- lim = 2;
- }
- for(int j = 1; j < lim; ++j){
- cin >> array[i][j];
- }
- }
- cout << "initiating screen assignment" << endl;
- for(int i = 0; i < amount; ++i){ //не работает
- if(array[i][0] != 0){
- cout << "Initiating function window" << endl;
- window(i);
- }
- else{
- cout << "Initiating function search. ";
- int k = search(array[i][1]);
- cout << "Initiating function window" << endl;
- window(k);
- }
- }
- cout << "Initiating screen displaying" << endl;
- for(int i = 0; i < 25; ++i){ //вывод работает
- for(int j = 0; j < 80; ++j){
- cout << screen[i][j];
- }
- cout << endl;
- }
- /*cout <<"Initiating array displaying" << endl;
- for(int i = 0; i < amount; ++i){ //тестовый вывод считанного массива, работает
- int lim = 6;
- if(array[i][0] == 0){
- lim = 2;
- }
- for(int j = 0; j < lim; ++j){
- cout << array[i][j] << ' ';
- }
- cout << endl;
- }*/
- delete array;
- return 0;
- }
- int search(int inputNumber){ //функция работает
- int i = 0;
- while(array[i][0] != inputNumber){
- ++i;
- }
- return i;
- }
- void window(int num){ //функция работает
- for(int i = array[num][1] - 1; i < array[num][3]; ++i){
- for(int j = array[num][2] - 1; j < array[num][4]; ++j){
- screen[i][j] = array[num][5];
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement