@rpichioli/

Some loops and matrix - Incomplete

C++

Trying to use conio.c and conio.h libraries to build a graphical app that compares arrays/matrix.

fork
loading
Files
  • main.cpp
  • conio.c
  • conio.h
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#include <stdio.h>
//#include <conio.h>
//#include <conio.c>

int main(){
	//textbackground(WHITE); clrscr();
    //textcolor(BLACK);textbackground(WHITE);
    
	int A[5][3],B[5][3],C[5][3],x,y,val1,val2,constA=3,constB=26,constC=49;
	
	//gotoxy(23,1);
	printf("Programa Soma Matrizes");
	
	for(x=1;x<6;x++){
		for(y=1;y<4;y++){
            A[x][y]=0;
		}
	}

	for(x=1;x<6;x++){
		for(y=1;y<4;y++){
            A[x][y]=0;
		}
	}
	
	//gotoxy(9,2);
	printf("A");
	//gotoxy(32,2);
	printf("B");
	//gotoxy(55,2);
	printf("S");
	
	//gotoxy(constA-2,3);textbackground(YELLOW);
	printf("[    ][    ][    ]");
	//gotoxy(constA-2,4);textbackground(YELLOW);
	printf("[    ][    ][    ]");
	//gotoxy(constA-2,5);textbackground(YELLOW);
	printf("[    ][    ][    ]");
	//gotoxy(constA-2,6);textbackground(YELLOW);
	printf("[    ][    ][    ]");
	//gotoxy(constA-2,7);textbackground(YELLOW);
	printf("[    ][    ][    ]");
	
	//gotoxy(21,5);textbackground(WHITE);
	printf("+");
	
	//gotoxy(constB-2,3);textbackground(CYAN);
	printf("[    ][    ][    ]");
	//gotoxy(constB-2,4);textbackground(CYAN);
	printf("[    ][    ][    ]");
	//gotoxy(constB-2,5);textbackground(CYAN);
	printf("[    ][    ][    ]");
	//gotoxy(constB-2,6);textbackground(CYAN);
	printf("[    ][    ][    ]");
	//gotoxy(constB-2,7);textbackground(CYAN);
	printf("[    ][    ][    ]");
	
	//gotoxy(44,5);textbackground(WHITE);
	printf("=");
	
	//gotoxy(constC-2,3);textcolor(WHITE);textbackground(RED);
	printf("[    ][    ][    ]");
	//gotoxy(constC-2,4);textcolor(WHITE);textbackground(RED);
	printf("[    ][    ][    ]");
	//gotoxy(constC-2,5);textcolor(WHITE);textbackground(RED);
	printf("[    ][    ][    ]");
	//gotoxy(constC-2,6);textcolor(WHITE);textbackground(RED);
	printf("[    ][    ][    ]");
	//gotoxy(constC-2,7);textcolor(WHITE);textbackground(RED);
	printf("[    ][    ][    ]");
	
	//gotoxy(14,15);textbackground(BLACK);textcolor(WHITE);
	printf("Desenvolvido por Rodrigo e Jefferson...");
	
	for(x=1;x<6;x++){
		for(y=1;y<4;y++){
			if(y==1){
                //gotoxy(constA,x+2);textcolor(BLACK);textbackground(YELLOW);
				scanf("%d",&val1);A[x][y]=val1;
            }    
            if(y==2){
                //gotoxy(constA+6,x+2);textcolor(BLACK);textbackground(YELLOW);
				scanf("%d",&val1);A[x][y]=val1;
            } 
            if(y==3){
                //gotoxy(constA+12,x+2);textcolor(BLACK);textbackground(YELLOW);
				scanf("%d",&val1);A[x][y]=val1;
            } 
		}
	}

	for(x=1;x<6;x++){
		for(y=1;y<4;y++){
			if(y==1){
                //gotoxy(constB,x+2);textbackground(CYAN);
				scanf("%d",&val2);B[x][y]=val2;
            }    
            if(y==2){
                //gotoxy(constB+6,x+2);textbackground(CYAN);
				scanf("%d",&val2);B[x][y]=val2;
            } 
            if(y==3){
                //gotoxy(constB+12,x+2);textbackground(CYAN);
				scanf("%d",&val2);B[x][y]=val2;
            } 
		}
	}
	
	for(x=1;x<6;x++){
		for(y=1;y<4;y++){
			C[x][y]=A[x][y]+B[x][y]; 
		}
	}
	
	for(x=1;x<6;x++){
		for(y=1;y<4;y++){
			if(y==1){
                //gotoxy(constC,x+2);textcolor(WHITE);textbackground(RED);
				printf("%d",C[x][y]);
            }    
            if(y==2){
                //gotoxy(constC+6,x+2);textcolor(WHITE);textbackground(RED);
				printf("%d",C[x][y]);
            } 
            if(y==3){
                //gotoxy(constC+12,x+2);textcolor(WHITE);textbackground(RED);
				printf("%d",C[x][y]);
            } 
		}
	}	
    //getch();    
}