0

How to get two strings in two lines?

I want to get a string that contains some sentences in line 1 and another string that contains tree digit in line 2 but after I try it 1th element of string1 changes! Why? cin.getline(sentences,200); //input:Hello! How are you? cin.getline(code,3); //input: 321

16th Feb 2021, 3:27 PM
Shakiba Majd
Shakiba Majd - avatar
2 Respuestas
+ 1
Ms.Majd Is it your attempt which you added in description
16th Feb 2021, 4:07 PM
R🍁🇮🇳
R🍁🇮🇳 - avatar
0
What exactly do you mean? That information can help you: C++ <iostream> std::cin.getline(str, max_length) function/method gets user input until newline is occurred or max_length characters is reached and assigns it to str.
16th Feb 2021, 4:29 PM
#0009e7 [get]
#0009e7 [get] - avatar