MIRZO ULUG’BEK NOMIDAGI O’ZBEKISYON
MILLIY UNVERSTETI
Matematika fakulteti Informatika va axborot texnologiyalari
Yo’nalishi 3 – kurs talabasi Karimov Ibrohim ning
Dasturiy tizim fanidan
MUSTAQIL ISHI
Qabul qildi: _______________
Toshkent – 2019
8 h.
S +A|-A|d|dC
A dC|d
C dC|d|D
D dD|d
Б(S,+) = A Б(S,-) = A
Б(S,d) = E Б(S,d) = A
Б(A,d) = C Б(A,d) = E
Б(C,d) = C Б(C,d) = E
Б(C,.) = D Б(D,d) = D Б(D,d) = E
E
C
D
A
S
-
+ d
d
. d
d d
d
NCHA ni DCHA ga o’tkazamiz.
Б(S,+) = A Б(S,-) = A Б(A,d) = CE
Б(CE,d) = CE Б(CE,.) = D Б(D,d) = DE
Б(DE,d) = DE
D
A
S
-
CE
+ d
d
. d
DE
d
#include
#include
#include
using namespace System;
using namespace std;
char c;
ifstream fin("DAS_TIZ.txt");
void get()
{
fin >> c;
}
int scan_G()
{
enum state{ S, A, CE, D, DE };
state CS;
CS = S;
do{
get();
switch (CS)
{
case S:
if (c == '+' || c == '-') CS = A;
else if (c == '$') goto t;
else CS = DE; break;
case A:
if (c == 'd') CS = CE;
else if (c == '$') goto t;
else CS = DE; break;
case CE:
if (c == 'd') CS = CE;
else if (c == '.') CS = D;
else if (c == '$') goto t;
else CS = DE; break;
case D:
if (c == 'd') CS = DE;
else if (c == '$') goto t;
else CS = DE; break;
}
} while ( CS != DE);
t:
{
if (CS==S && CS!=DE) return 1;
else return 0;
}
if (CS == DE) return 0;
else return 1;
}
int main()
{
int i;
fin.open("C:\\DAS_TIZ.txt");
i = scan_G();
if (i) cout << "\nTo'g'ri zanjir!\n\n";
else cout << "\nNoto'g'ri zanjir!\n\n";
system("pause");
return 0;
}
7h) S Sa | Cc | a
C Bb
B Sa | a
Б(S,a) = S Б(C,c) = S Б(H,a) = B
Б(S,a) = B Б(H,a) = S Б(B,b) = C
H
a
C
c
S
a b
B
a a
NCHA ni DCHA ga o’tkazamiz.
Б(H,a) = BS Б(BS,a) = S Б(C,c) = S
Б(H,b) = C
H
C
c
S
a
BS
a
#include
#include
#include
using namespace System;
using namespace std;
char c;
ifstream fin("DAS_TIZ.txt");
void get()
{
fin >> c;
}
int scan_G()
{
enum state{ S, A, CE, D, DE };
state CS;
CS = S;
do{
get();
switch (CS)
{
case S:
if (c == '+' || c == '-') CS = A;
else if (c == '$') goto t;
else CS = DE; break;
case A:
if (c == 'd') CS = CE;
else if (c == '$') goto t;
else CS = DE; break;
case CE:
if (c == 'd') CS = CE;
else if (c == '.') CS = D;
else if (c == '$') goto t;
else CS = DE; break;
case D:
if (c == 'd') CS = DE;
else if (c == '$') goto t;
else CS = DE; break;
}
} while ( CS != DE);
t:
{
if (CS==S && CS!=DE) return 1;
else return 0;
}
if (CS == DE) return 0;
else return 1;
}
int main()
{
int i;
fin.open("C:\\DAS_TIZ.txt");
i = scan_G();
if (i) cout << "\nTo'g'ri zanjir!\n\n";
else cout << "\nNoto'g'ri zanjir!\n\n";
system("pause");
return 0;
}
Do'stlaringiz bilan baham: |