Jump to content
Fórum Script Brasil
  • 0

Resolução de exercico não esta funcionando


Sicks
 Share

Question

Ola pessoal

Estava fazendo um exercicio e sai com essa resolução:

#include <stdio.h>
#include<string.h>
#include <conio.h>
#include <math.h>
#include<stdlib.h>

int main () {
int nt,n,conta[128],contf[128];
char c=0;

scanf("%d", &nt);

while(nt != n)
{
         while(c != '\n')
         {
                 c = getchar();
                 if(c == '(' || c == '[' || c == '{')
                 conta[c]++;
                 if(c == ')' || c == ']' || c == '}')
                 contf[c]++;
         }
if( conta['('] != contf[']'] || conta['['] != contf[']'] || conta['{'] != contf['}'] )
    printf("N");
else
    printf("S");
    
    
n++;
}  
}

A resolução compila sem problemas mas o programa não executa essa linha c = getch(); <_<

ele simplesmente pula ela

alguém sabe qual poderia ser o problema?

Ps: ele entra nos dois whiles mas simplesmente não executa essa linha :blink:

Edited by Durub
Adicionar tags code [Durub]
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

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.

 Share



  • Forum Statistics

    • Total Topics
      150.8k
    • Total Posts
      648.7k
×
×
  • Create New...