User Inputs & If Statements in C++ - 1.3

  Рет қаралды 2,572

Ferrabacus

Ferrabacus

Күн бұрын

Пікірлер: 4
@marcusantenor793
@marcusantenor793 2 ай бұрын
can you help explain why the input validation doesn't work inside the createArr function, please? #include using namespace std; string* createArr(unsigned int arrSize); void displayArr(unsigned int arrSize); string* createArr(unsigned int arrSize) { string* newArr = new string[arrSize]; for(unsigned int i{0}; i < arrSize; i++) { string name{}; cout
@SnoopGod0420
@SnoopGod0420 2 жыл бұрын
Hello was wondering if there is a way to do this with characters, I am making a program in school that receives a random string and looks for the longest streaks of C so ADDDCCCCCBSIJCCCJJJJSKSKCCC Would get 5 being longest streak been stuck on for a while and cannot find anything online I understand enough to remember for exam practice
@astechigen6174
@astechigen6174 3 жыл бұрын
Would be nice if you introduce the definition of error flags before using it and explain why do we have to "reset" cin (or why it "messes up" in the first place). I've understood that when we assign an invalid value to a data type somewhat error occurs and we have to clear the buffer (I don't know what that does mean) to get rid of the error's consequences. But could you please get into the detail of this? Or at least explain it in simple terms.
@ferrabacus2980
@ferrabacus2980 3 жыл бұрын
Hey Rahmanyaz, the buffer is just temporary space like a file. So when the user enters in a response, it goes to a buffer, then gets pulled from the buffer to your program. That way we can easily direct it other places. The error flags are Boolean variables that are set to false when this event occurs, other parts of cin will check against those variables to see if it is still working properly so we have to reset them. I was trying to give an overview here instead of going into too much detail because it brings up a lot of conversations about classes, and those are generally learned much later! Hope this helps!
Arithmetic Operators and Precedence in C++ - 1.4
21:17
Ferrabacus
Рет қаралды 1,2 М.
How To Make Void Functions in C++ - 2.1
27:24
Ferrabacus
Рет қаралды 4,2 М.
Fake watermelon by Secret Vlog
00:16
Secret Vlog
Рет қаралды 34 МЛН
Osman Kalyoncu Sonu Üzücü Saddest Videos Dream Engine 269 #shorts
00:26
Mom had to stand up for the whole family!❤️😍😁
00:39
MAGIC TIME ​⁠@Whoispelagheya
00:28
MasomkaMagic
Рет қаралды 26 МЛН
#9: If Else Statements in C | C Programming for Beginners
12:51
Programiz
Рет қаралды 199 М.
FileIO (Input/Output) in C++ - #3.6
43:54
Ferrabacus
Рет қаралды 3,3 М.
Casting and Basic Strings in C++ - 1.5
33:00
Ferrabacus
Рет қаралды 678
I Feel Bad For New Programmers
19:12
ThePrimeTime
Рет қаралды 491 М.
31 nooby C++ habits you need to ditch
16:18
mCoding
Рет қаралды 810 М.
C Arrays in C++ - 2.5
26:53
Ferrabacus
Рет қаралды 657
While Loops & String Manipulation in C++ - 2.3
36:14
Ferrabacus
Рет қаралды 5 М.
Vectors, Maps, C Structs in C++ - 3.5
34:26
Ferrabacus
Рет қаралды 6 М.
Input and Output in C++
18:09
Neso Academy
Рет қаралды 267 М.
Fake watermelon by Secret Vlog
00:16
Secret Vlog
Рет қаралды 34 МЛН