Jump to content
Fórum Script Brasil
  • 0

DUVIDA (CÓDIGO) USANDO WHILE


athoslive

Question

Meu código não funciona muito bem...

#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <time.h>
#include <dos.h>
#include <ctype.h>
void main()
{
    char a;
   int col = 10;
   int col2= 75;
   int tentativas=10;
   clrscr();
   printf("joguinho legal , digite D-F para atirar embaixo / E-R para atirar emcima / W-S para subir e descer com a nave, e Q para sair");
   while(tentativas<100)
   {
   if (kbhit())
    a=tolower(getch());

    gotoxy(col2--,3);
    printf(" <-þ \r");
        if(col2==5)
        {
        printf("Voce perdeu,aperte algo para sair.");
        a==getch();
        exit(1);
        }
        else
        {
        gotoxy(col2++,3);
        printf(" þ-> \r");
            if(col2==71)
            a=' ';
        }



    gotoxy(col2--,2);
    printf(" <-þ \r");
        if(col2==5)
        {
        printf("Voce perdeu,aperte algo para sair.");
        a==getch();
        exit(1);
        }
        else
        {
        gotoxy(col2++,2);
        printf(" þ-> \r");
            if(col2==71)
            a=' ';
        }


   if(a=='d')
    {
      clrscr();
      printf("\n\n    >-");
      gotoxy(col--, 3);
      printf(" ® \r");
      if (col == 8)
    a = ' ';
      delay(30);
      }
   if(a=='f')
    {

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...