Lesson 2 of 24

Variables, auto आणि string

8 min 20 XP

C++ मध्ये bool (true/false) आणि string (मजकूर) आहेत, त्यामुळे C च्या char-array ची डोकेदुखी संपली. auto मुळे compiler तुमच्यासाठी type ठरवतो.

Example: edit me and press Run

Output Loading C++ (first time takes a few seconds)
Press Run to see the result here.

bool default ने 1/0 असा print होतो; boolalpha true/false print करते. दशांश स्थानांसाठी <iomanip> मधून fixed << setprecision(2) वापरा.

Challenge

+20 XP

string course मध्ये "C++" आणि int hours मध्ये 40 ठेवा, मग print करा: Course: C++ Hours: 40

Output Loading C++ (first time takes a few seconds)
Press Run to see the result here.