car using C graphics (code available in comments). #coding #shorts #programming #viral

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

#include <stdio.h>
#define max 15
char stk[max];
int top = -1;
int pre[10],
topPre=-1;
void pushpre(int );
int check(char);
void push(char);
void popPre();
void display();
int main()
{
char str[30];
int i=0, chk, prev;
printf(" enter expression ");
gets(str);
while(str[i]!='\0')
{
push(str[i]);
i++;
}
i=0;
while(str[i]!='\0')
{
chk=check(str[i]);
prev=chk;
if(chk<=4)
{
pushpre(prev);
}
else if(pre[topPre]==chk)
{
popPre();
}
i++;
}
if(topPre==-1)
printf("correct");
else
printf("incorrect");
return 0;
}
int check(char ch)
{
switch (ch)
{
case '(':
return 1;
break;
case ')':
return 10;
break;
case '[':
return 2;
break;
case ']':
return 20;
break;
case '{':
return 3;
break;
case '}':
return 30;
break;
case '<':
return 4;
break;
case '>':
return 40;
break;
default:
return -1;
}
}
void pushpre(int ch)
{
if (!(topPre == 9))
{
topPre++;
pre[topPre] = ch;
}
}
void push(char ch)
{
if (!(top == max - 1))
{
top++;
stk[top] = ch;
}
}
void popPre()
{
char item;
if (!(topPre == -1))
{
topPre--;
}
}

eaglionprogrammers
Автор

thanks for providing code in comments !!! really
appreciate it

yashmahajanco
Автор

Bhai kya jabardast editing karte ho aap

makiohoja
Автор

Jo khubsorat aakhe 👀 ye comment padh rahi he uske Har sapne pure ho

makiohoja
Автор

Bhai plzz ek like aap karo mere comment ko

makiohoja
join shbcf.ru