-Programa 12-
modificado- Hacer un ciclo para capturar 20 datos en un vector. Los datos únicamente deberán guardarse si son mayores a 35.
#include <stdlib.h>
#include <windows.h>
#include <stdio.h>
using namespace std;
void captura();
void imprimir();
void firma();
void margen();
void gotoxy(int x,int y){
HANDLE hcon;
hcon=GetStdHandle(STD_OUTPUT_HANDLE);
COORD dwPos;
dwPos.X=x;
dwPos.Y=y;
SetConsoleCursorPosition(hcon,dwPos);
}
int vec[20],i,j,h,datos;
int main()
{
captura();
imprimir();
firma();
margen();
return 0;
}
void captura()
{
cout <<endl<<" Funcion captura " <<endl;
cout << " CAPTURA 20 DATOS EN UN VECTOR SI SON MAYORES A 35 " << endl;
for (i=0; i<=19; i++)
{
cout <<" Ingresa el dato: ";
cin >> datos;
if (datos>35)
vec[i]=datos;
}
cout <<" Fin funcion captura " <<endl;
}
void imprimir()
{
cout <<endl<<" Funcion imprimir "<<endl;
for (h=0; h<=19; h++)
{
cout <<"\t"<< vec[h] <<endl;
}
cout <<" Fin funcion imprimir "<<endl;
}
void firma()
{
for(j=1; j<=1; j++)
{
gotoxy(j,48); //Posiciona el cursor en columna 15 y fila de 1 a 25
system("color F3"); //Cambia el color del texto
cout<<" --------> Elaborado por Dirce Ramirez ";
//system("cls"); //Borra la pantalla
}
for(j=1; j<=2; j++)
{
gotoxy(55,j); // Posiciona el cursor en la fila 15 y la colunma cambia de 1 a 25
system("color F3");
cout<<" °°Dirce Ramirez°° ";
//system("cls");
}
}
void margen()
{
for(int x=1; x<=79; x++)
{
gotoxy (x,0);
putchar ('*');
gotoxy (x,50);
putchar ('*');
}
for(int y=1; y<=50; y++)
{
gotoxy (0,y);
putchar ('*');
gotoxy (79,y);
putchar ('*');
}
}

No hay comentarios:
Publicar un comentario