Lesson 3 of 24

cin மற்றும் getline மூலம் InputInput with cin and getline

8 min 20 XP

cin >> x space அல்லது புதிய வரி வரை ஒரு மதிப்பைப் படிக்கும். Space உள்ள முழு வரிக்கு getline(cin, s). cin >> பிறகு getline பயன்படுத்தும் முன் cin.ignore() தேவை.

cin >> x reads one value up to a space or new line. For a whole line with spaces use getline(cin, s). After cin >>, call cin.ignore() before getline to skip the leftover newline.

Example: edit me and press Run

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

Challenge

+20 XP

Celsius வெப்பநிலையைப் (double) படித்து Fahrenheit-ஆக 1 தசம இடத்துடன் print செய்யுங்கள் (F = C × 9 / 5 + 32). Input: 37 → Output: 98.6

Read a Celsius temperature (double) and print it in Fahrenheit with 1 decimal place (F = C × 9 / 5 + 32). Input: 37 → Output: 98.6

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