DEV Community

BUTTSAN
BUTTSAN

Posted on

Assalomu aleykum 13.08.24 biz c++ codlash tilida 5 darsimizni otdik va bu men tushungan narsalarim.

birinchisi biz uchta kutubhona chakiramiz ikinchisi esa ikta verible yaratamiz va unga nom beramiz
va ularga kiymat beramiz bu son kelgin esa ularni hohishingizga karab yoki koshasiz yoki ayirasiz
yana oz hohishizga qarab ularga boshqa son ham berisingiz mumkin pasta korib turibsiz va ohiriga cout kilamiz

#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;
int main(){
int a = 5, b= 7;

Enter fullscreen mode Exit fullscreen mode
Enter fullscreen mode Exit fullscreen mode

kelgisi
bu cod 5 honali sonni yaxlitlab beradi masalan input; 13900,
yozilsa 14000 chiqazadi.

int main (){
    int son ;
    cin >> son;

    float newSon = son;
    cout << round(newSon / 1000) * 1000;

    return 0;
}

Enter fullscreen mode Exit fullscreen mode

bu cod birorta sonni necha soat , necha minut , necha secund ekanligini chiqazib beradi.

int main (){
    int secund;
    cin >> secund;
    cout << setw(2) << setfill ('0') << secund / 3600 << ":"; 
    cout << setw(2) << setfill ('0') << secund % 3600 / 60 << ":"; 
    cout << setw(2) << setfill ('0') << secund % 60 << ":"; 

    return 0;

}
Enter fullscreen mode Exit fullscreen mode

va shu bilan men sizlar bilan hayirlashaman

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay