insert
Code:
#include <conio2.h>
#include <windows.h>
#include <time.h>
#include <clock.h>
struct text_info info;
struct char_info * screen_buffer;
int i;
int cursor_pos_x, cursor_pos_y;
void sorteo();
int message();
int choice;
char Message[]="RANDOM NUMS!";
int main()
{
char password[10];
/* we want to restore current text attributes on the end of application */
inittextinfo();
/* get the info about screen */
gettextinfo( &info );
/* get the info about screen */
gettextinfo( &info );
/* paint border around screen */
gotoxy( 1, 1 );
for (i = 1; i <= info.screenwidth; i++) putch( '*' );
gotoxy( 1, info.screenheight );
for (i = 1; i < info.screenwidth; i++) putch( '*' );
for (i = 2; i < info.screenheight; i++) {
putchxy( 1, i, '*' );
putchxy( info.screenwidth, i, '*' );
}
textbackground(13);
_setcursortype(_SOLIDCURSOR);
textcolor(5);
clrscr();
gotoxy(30,2);
printf("%s\n\n",Message);
message();
return 0;
}
void sorteo(void)
{
printf("\nLos nums son: ");
for(int i=1;i<3;i++)
{
for(int q=0;q<=200000000;q++);
printf("%d ",rand()%48 + 1);
}
gotoxy(20,15);
printf("\nPresione cualquier tecla para continuar\n");
gotoxy(40,15);
getche();
}
int message()
{
for (int i = 1; i <= info.screenwidth; i++) putch( '*' );
gotoxy( 1, info.screenheight );
for (int i = 1; i < info.screenwidth; i++) putch( '*' );
for (int i = 2; i < info.screenheight; i++) {
putchxy( 1, i, '*' );
putchxy( info.screenwidth, i, '*' );
}
gotoxy(30,5);
printf("Menu del Programa\n");
gotoxy(20,7);
printf("Entra uno (1) para recibir numeros del sorteo\n");
gotoxy(20,9);
printf("Entra uno (2) para salir del programa\n");
gotoxy(20,10);
printf("Su respuesta es : ");
gotoxy(39,10);
scanf("\n\n%i",&choice);
gotoxy( 1, 1 );
switch(choice)
{
case 1:
sorteo();
break;
case 2:
system("cls");
gotoxy(30,4);
printf("Adios, vuelva pronto!!\n\n\n\n\n\n");
getch();
exit(1);
}
system("cls");
gotoxy(25,5);
char otra;
while(otra!='n')
{
system("cls");
gotoxy(19,5);
printf("Desea volver a intentar otros numeros? [y/n]\n\n");
gotoxy(65,5);
otra = getch();
if(otra=='n')
{
system("cls");
gotoxy(30,4);
printf("Adios, vuelva pronto!!\n\n\n\n\n\n");
Sleep(200);
break;
}
else;
sorteo();
}
}
Salem like i said it always prints same 3random nums sequence when i start the prog