Kiritilgan belgini nima ekanligini aniqlovchi dastur tuzilsin. Adar kiritilgan belgi raqam bo’lsa "digit" harf bo’lsa "lotin" yozuvi chiqsin


Download 228.07 Kb.
Sana08.05.2023
Hajmi228.07 Kb.
#1446807
Bog'liq
dasturlashdan oxirgi dedlinenim string


1-Topshiriq
Kiritilgan belgini nima ekanligini aniqlovchi dastur tuzilsin. Adar kiritilgan belgi raqam bo’lsa “digit” harf bo’lsa “lotin” yozuvi chiqsin.
#include
#include
#include

using namespace std;


int main()
{
char s;
f: cout<<"\t\t\t\t\t KICHIK DASTURIMGA HUSH KELIBSIZ!"<cout<<" "<cout<<"\t\tBiror belgi kiriting dastur sizga bu belgi nima ekanligini aniqlab beradi"<cout<<"\t Belgi: "; cin>>s;


if(isdigit(s)){
cout<<"\t Digit"<}else if(isalpha(s)){
cout<<"\t Lotin"<}else{
cout<<"\t 0";
}
int k;
cout<<"\t\t0 Chiqish\t 1 Asosiy menu"<cout<<"\tSon kiriting: ";cin>>k;
if(k==0)
{
cout<<"\t\t\t\tEtiboringiz uchun rahmat!"<system("exit");
}
else if (k==1)
{ system("cls");
goto f;
}
return 0;
}
2-Topshiriq
S1 vaS2 satrlari berilgan. S2 satrini S1 satrida takrorlanishlar sonini chiqaruvchi programma tuzilsin.
#include
#include
using namespace std;

int main()


{
ofstream fayl;
string satr = "C++ daturlash tili menga yoqti";
fayl.open("C:\\text.txt");
if(fayl){
fayl<cout<<"faylga yozildi"<cout<fayl.close();
}else{
cout<<"fayl yaratilmadi";
}
ifstream f1;
f1.open("C:\\text.txt");
ofstream ff;
ff.open("C:\\text2.txt");
string a;
int i=0;
if(f1){ f1>>a; f1.close();}
if(ff){
ff<cout<<"2-faylga yozildi"<ff.close();
}
cout<return 0;
}


Download 228.07 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling