# Старший преподаватель

 bet 7/8 Sana 26.06.2022 Hajmi 3,43 Mb. #706242 Turi Лекции
Bog'liq
R0GtQ8oI6GqIdteM4fsLYP5anAf3lVKxkWzOofoH

## Misol

#include
#include
#include
using namespace std;
int main() {
ifstream oqi("1.txt");
if (!oqi.is_open()){
int i=1,e1=0,e2=0,z2=0;string line,str;
bool s=0,s1=0,s2=0;
// fayl o'hirigacha oqish
{
if(oqi.fail())break; // faylda malumot tugashi
e1=0;e2=0;string h=""; int h2=0;
// fayldan ozlashtirilgan qatornu ohirigacha oqish
// Ushbu satrda vazifadan berilgan aktiv belgilarni aniqlash

## Davomi…

for (int t=0;ts=0;s1=0;s2=0;e1=0;e2=0;
string d; d.assign(line,t,1);
// satrni har bir elementini d ga ozlashtiradi
// leksik tahlil uchun
if (d=="="||d=="+"||d=="-"||d=="*"||d=="/"){
// sintaksiz tahlil uchun
if(line[t-1]=='+'|| line[t-1]=='-'|| line[t-1]=='*'||line[t-1]=='/'){
if(d!="="&&(line[t-2]!='+'||line[t-2]!='-'||line[t-2]!='*'||line[t-2]!='/')){
cout<}
if(line[t+1]=='+'|| line[t+1]=='-'|| line[t+1]=='*'||line[t+1]=='/'){
// sintaktik tahlil uchun
if (d=="=")
{cout<<"Barobardan keyin ishora mumkin emas"<e1=1;
} }

## Davomi…

float a;
if (atof(h.c_str())){
a=atof(h.c_str());
cout<<"NUMBER("<}else
if(e1!=1){
cout<<"IDENTIFIKATOR( "<cout<<"\t\t\t\t OPERATOR("<s=1;s1=0;s2=0;
}
h2=0;h.clear();
}
else if(d==";"||d==","){
e2=t;s1=1;s=0;s2=0;

## Davomi…

// sintaktik tahlil uchun
if((d!=",") && line[t-1]=='+' || line[t-1]=='-' || line[t-1]=='*' || line[t-1]=='/')
{if(d!="="&&(line[t-2]=='+'||line[t-2]=='-'||line[t-2]=='*'||line[t-2]=='/'))
{ cout<e1=1;}
}
if(line[t+1]=='+'|| line[t+1]=='-'|| line[t+1]=='*'||line[t+1]=='/'){
// sintaktik tahlil uchun
if(d==","){
cout<<"Verguldan keyin ishora mumkin emas"<e1=1;
}
}