4 – Laboratoriya ishi


Download 250.68 Kb.
Sana17.12.2022
Hajmi250.68 Kb.
#1025482
Bog'liq
4-Deadline(12)


4 – Laboratoriya ishi

12. Kodlar jadvalida kiritilgan belgidan oldin va keyin turuvchi belgilarni


chiqaruvchi dastur tuzing.


Dastur kodi:
#include

using namespace std;


int main()


{
int belgi;
cout << "Belgi kiriting: ";
cin >> belgi;
if (belgi)
{
cout << "oldingi belgi: " << belgi - 1 << endl;
cout << "keyingi belgi: " << belgi + 1 << endl;
}
else
{
cout << "Bitta belgi kiriting!" << endl;
}
return 0;
}


Dastur natijasi:

Yoki
Dastur kodi:
#include

using namespace std;


int main()


{
char c;
int belgi;

cout << "Belgi kiriting: ";


cin >> c;

belgi = (int) c;


cout << c << " dan oldingi belgi: " << (char) (belgi - 1) << endl;
cout << c << " dan keyingi belgi: " << (char) (belgi + 1) << endl;

system("pause");


return 0;
}


Dastur natijasi:

Download 250.68 Kb.

Do'stlaringiz bilan baham:




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