MANEJO DE COORDENADAS EN PANTALLA - USO DE FUNCIONES
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <windows.h>
//DECLARACION DE FUNCION
int suma(int num1, int num2);
void gotoxy(int x,int y);
int a, b;
int main(){
gotoxy(40,12);
printf("Ingrese un numero \n");
gotoxy(40,11);
scanf("%d",&a);
gotoxy(40,10);
printf("Ingrese otro numero \n");
gotoxy(40,9);
scanf("%d", &b);
//LLAMADA A LA FUNCION
//c=suma(a,b);
gotoxy(40,8);
printf("La suma es: %d",suma(a,b));
getch();
}
int suma(int num1, int num2){
int resultado=0;
resultado=num1+num2;
return resultado;
}
void gotoxy(int x,int y){
HANDLE hcon;
hcon = GetStdHandle(STD_OUTPUT_HANDLE);
COORD dwPos;
dwPos.X = x;
dwPos.Y= y;
SetConsoleCursorPosition(hcon,dwPos);
}
#include <stdlib.h>
#include <conio.h>
#include <windows.h>
//DECLARACION DE FUNCION
int suma(int num1, int num2);
void gotoxy(int x,int y);
int a, b;
int main(){
gotoxy(40,12);
printf("Ingrese un numero \n");
gotoxy(40,11);
scanf("%d",&a);
gotoxy(40,10);
printf("Ingrese otro numero \n");
gotoxy(40,9);
scanf("%d", &b);
//LLAMADA A LA FUNCION
//c=suma(a,b);
gotoxy(40,8);
printf("La suma es: %d",suma(a,b));
getch();
}
int suma(int num1, int num2){
int resultado=0;
resultado=num1+num2;
return resultado;
}
void gotoxy(int x,int y){
HANDLE hcon;
hcon = GetStdHandle(STD_OUTPUT_HANDLE);
COORD dwPos;
dwPos.X = x;
dwPos.Y= y;
SetConsoleCursorPosition(hcon,dwPos);
}
Comentarios
Publicar un comentario