miércoles, 6 de noviembre de 2019

Programa 26(Firma)

#include <stdio.h>
#include <iostream>
#include <windows.h>
#include <time.h>
using namespace std;

void gotoxy(int x,int y){
HANDLE hcon;
hcon=GetStdHandle(STD_OUTPUT_HANDLE);
COORD dwpos;
dwpos.X=x;
dwpos.Y=y;
SetConsoleCursorPosition(hcon, dwpos);
}
void completado();
void calcular();
void impresion();

float mat[5][5],x=5,y=8,n=0;

int main(){
system("color F0");
completado();
calcular();
impresion();
}

void completado(){
int n;
srand(time(NULL));
for(int i=0; i<=3; i++){
for(int j=0; j<=3; j++){
n=rand()/1000;
mat[i][j]=n;
}
}
for(int i=0; i<=4; i++){
for(int j=0; j<=4; j++){
gotoxy(x,y);
cout<<mat[i][j];
x+=5;
}
y+=2;
x=5;
}
system("pause");
system("cls");
}

void calcular(){
mat[0][4]=mat[0][0]+mat[0][1]+mat[0][2]+mat[0][3];
mat[0][4]=mat[0][4]/4;
mat[1][4]=mat[1][0]+mat[1][1]+mat[1][2]+mat[1][3];
mat[1][4]=mat[1][4]/4;
mat[2][4]=mat[2][0]+mat[2][1]+mat[2][2]+mat[2][3];
mat[2][4]=mat[2][4]/4;
mat[3][4]=mat[3][0]+mat[3][1]+mat[3][2]+mat[3][3];
mat[3][4]=mat[3][4]/4;
mat[4][0]=mat[0][0]+mat[1][0]+mat[2][0]+mat[3][0];
mat[4][0]=mat[4][0]/4;
mat[4][1]=mat[0][1]+mat[1][1]+mat[2][1]+mat[3][1];
mat[4][1]=mat[4][1]/4;
mat[4][2]=mat[0][2]+mat[1][2]+mat[2][2]+mat[3][2];
mat[4][2]=mat[4][2]/4;
mat[4][3]=mat[0][3]+mat[1][3]+mat[2][3]+mat[3][3];
mat[4][3]=mat[4][3]/4;
mat[4][4]=mat[0][4]+mat[1][4]+mat[2][4]+mat[3][4];
mat[4][4]=mat[4][4]/4;
system("pause");
system("cls");
}
void impresion(){
for(int i=0; i<=4; i++){
for(int j=0; j<=4; j++){
gotoxy(x,y);
cout<<mat[i][j];
x+=5;
}
y+=2;
x=5;
}
system("pause");
for(int i=1; i<=1; i++){
gotoxy(36,i);
for(int i=0; i<=0; i++){
cout<<"B";
Sleep(100);
}
for(int i=0; i<=0; i++){
cout<<"a";
Sleep(100);
}
for(int i=0; i<=0; i++){
cout<<"r";
Sleep(100);
}
for(int i=0; i<=0; i++){
cout<<"b";
Sleep(100);
}
for(int i=0; i<=0; i++){
cout<<"a";
Sleep(100);
}
for(int i=0; i<=0; i++){
cout<<" ";
Sleep(100);
}
for(int i=0; i<=0; i++){
cout<<"M";
Sleep(100);
}
for(int i=0; i<=0; i++){
cout<<"e";
Sleep(100);
}
for(int i=0; i<=0; i++){
cout<<"d";
Sleep(100);
}
for(int i=0; i<=0; i++){
cout<<"i";
Sleep(100);
}
for(int i=0; i<=0; i++){
cout<<"n";
Sleep(100);
}
for(int i=0; i<=0; i++){
cout<<"a";
Sleep(100);
}
for(int i=0; i<=0; i++){
cout<<" ";
Sleep(100);
}
for(int i=0; i<=0; i++){
cout<<"C";
Sleep(100);
}
for(int i=0; i<=0; i++){
cout<<"a";
Sleep(100);
}
for(int i=0; i<=0; i++){
cout<<"r";
Sleep(100);
}
for(int i=0; i<=0; i++){
cout<<"l";
Sleep(100);
}
for(int i=0; i<=0; i++){
cout<<"o";
Sleep(100);
}
for(int i=0; i<=0; i++){
cout<<"s ";
Sleep(100);
}
}
system("pause");
system("cls");
}

No hay comentarios:

Publicar un comentario