DEV Community

Jama1812
Jama1812

Posted on • Edited on

C++ lesson 2

Assalomu Aletkum bugun biz matn ichidagi maxsus buyuruqlar blan tanishamiz.

Biz maxsus buyuruqlari ishlatish uchun \dan ya'ni maxsus buyuruq belgisidan foydalanamiz.

1) \n bu kodni ishlatsak biz yozayotgan satrni keyingi satrga ko'chirib beradi.

#include <iostream>

using namespace std;

int main(){

    cout <<"Salom \nDunyo";

    return 0;
}
Enter fullscreen mode Exit fullscreen mode

Bunday holda manabunday javob qaytaradi:

Salom

Dunyo

2) \t bu kodni ishlatsak biz yozayotgan satrdan 3 bo'shliq tashab davom ettirib ketadi.

#include <iostream>

using namespace std;

int main(){

    cout <<"Salom \tDunyo";

    return 0;
}
Enter fullscreen mode Exit fullscreen mode

Bu holda bizda manabunday javob qaytaradi:

Salom Dunyo

3) \" buyurig'dan foydalanish.Bu kod bizga matn qo'shtirnoqlarin yopib qo'ymaslik uchun kerak.

#include <iostream>

uisng namespace std;

int main(){
    cout << "\"Kitob-bilm manbai\"";

    return 0;
}
Enter fullscreen mode Exit fullscreen mode

Bu holda bizga manabuday javob qaytaradi:

"Kitob-bilm manbai"

3) \\ buyurig'idan foydalanish.Bu kod bizga maxsus kod belgisini chiqarish uchun kerak.

#include <iostream>

using namespace std;

int main(){

    cout << "\\" ;


   return 0;
}
Enter fullscreen mode Exit fullscreen mode

Bu holda bizga manabunday javob qaytaradi:

\

@dawroun

Top comments (0)