Handling String Input With Spaces | C++ Tutorial

  Рет қаралды 38,541

Portfolio Courses

Portfolio Courses

Күн бұрын

Пікірлер: 51
@AdverTyy
@AdverTyy 7 ай бұрын
literally the goat of c++ courses
@arunyagoojar1889
@arunyagoojar1889 2 жыл бұрын
short and simple , thanks .
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
You're welcome Arunya! :-D
@tweetyguy7347
@tweetyguy7347 8 ай бұрын
Thanks! When I was writing a little todo list rest project, I was confused on why when there was a space in my string inputs, it would only use the first word inputted and make any following words apart of the next inputs in my loop.
@NikitaNair
@NikitaNair 10 ай бұрын
Thank you!! I really needed this
@PortfolioCourses
@PortfolioCourses 10 ай бұрын
You're welcome! BTW, you have a nice channel and a great singing voice! :-)
@laurenceflores9807
@laurenceflores9807 Жыл бұрын
so simple and easy to understand, thankyou sir have a nice life!
@SagarKumar-kf7eo
@SagarKumar-kf7eo 2 жыл бұрын
Wow, sath sath m virat kohli ka promotion b hogya
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
I'm not sure what that means Sagar. :-)
@rahulrai1530
@rahulrai1530 2 жыл бұрын
@@PortfolioCourses He meant that, aside from us receiving some knowledge, Virat Kohli got some promotion as well.
@HiteshKumar-lu9wj
@HiteshKumar-lu9wj 3 күн бұрын
i was checking score of virat during video and suddenly you write virat kohli 😎😎
@yousaf2003
@yousaf2003 2 жыл бұрын
Congratulations 👏👏 on 9000 subscribers Keep it up 🔥
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
Thank you very much Yousaf! 😀
@ramakrishna4092
@ramakrishna4092 2 жыл бұрын
congratulations sir for 9k sub ...
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
Thank you Rama! :-)
@ramakrishna4092
@ramakrishna4092 2 жыл бұрын
​@@PortfolioCourses hi sir I came across this question after seeing your video about extern I have a question suppose in my .h file I declare a global variable and linked to my main. c with the help of extern , is it possible to change the value in main .c file (which is declared in another file ) , if possible how to achieve this , it will be helpful to my studies if you do a video on this topic , thanks for helping and a quick response for your sub .... Thanks again sir...
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
@@ramakrishna4092 Yes, we can change the value in main.c. This video should cover how to do this: kzbin.info/www/bejne/jaLQYqeJr9Kkobs. The example code is here: github.com/portfoliocourses/c-example-code/tree/main/extern_share_global_variable.
@Grandfather__
@Grandfather__ Жыл бұрын
You really helped me, man! If I'd be near to u, I'd hug u! Sry for typos, I am Russian. If u can, please, tell me about my mistakes!
@PortfolioCourses
@PortfolioCourses Жыл бұрын
Awesome, I'm glad the video helped you out! :-) Your English seems pretty good to me.
@ganeshmishraa
@ganeshmishraa Жыл бұрын
Amezing sir understand this concept very easily ❤🎉
@damarcuswilson1
@damarcuswilson1 10 ай бұрын
I notice the geline didn't work for me when there was a math equation statement that comes before it. When I switched it, it worked fine.
@mohanedalbkry8921
@mohanedalbkry8921 6 ай бұрын
thanks that will help me a lot
@sportgamer4482
@sportgamer4482 8 ай бұрын
Are you a kohli fan?
@AlbeezyOfc
@AlbeezyOfc Жыл бұрын
Goat
@PortfolioCourses
@PortfolioCourses Жыл бұрын
Thank you! :-)
@muhammadzaidmuckba9097
@muhammadzaidmuckba9097 Жыл бұрын
@@PortfolioCourses not trying to be mean or rude but I guess he was calling Virat, Goat 😂
@PortfolioCourses
@PortfolioCourses Жыл бұрын
@@muhammadzaidmuckba9097 hahaha oh I bet you're right Muhammad, that's hilarious! 😂
@hafizsakib2734
@hafizsakib2734 2 жыл бұрын
sir, if we want to take input strings in multiple test cases ,it takes the enter as a string; currently I am handling it like this : int t; cin >> t; while(t--){ string s; char c; cin >> c; getline(cin, s); //example string : the devil in the sky ( I want to take it input as a single string) s = c + s; } //assume that I want to take the same string (the devil in the sky) 3 times,but while running the programme,it will take input 2 times because 1st time it take "enter" as a string(while we input the value 't' then enter) Is there any better approach ? I have heared about c++ ignore file or something like that but coudn't get it. please can you solve this problem ,please give me the answer as code... Thanks for reading,you are awssome!
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
You should be able to use cin.ignore(), like right after cin>>t for example. This video may help: kzbin.info/www/bejne/nJTcmImqeb2UpK8. :-)
@hafizsakib2734
@hafizsakib2734 2 жыл бұрын
@@PortfolioCourses It's 100% clear now sir Thanks
@rolandandreiventura1571
@rolandandreiventura1571 Жыл бұрын
Thanks Broooo!\
@PortfolioCourses
@PortfolioCourses Жыл бұрын
@@rolandandreiventura1571 You're welcome Roland! 🙂
@MubahDotkom
@MubahDotkom Жыл бұрын
thanks
@danish15
@danish15 Жыл бұрын
King Kohli supremacy 👑
@PortfolioCourses
@PortfolioCourses Жыл бұрын
:-)
@KuriZaki
@KuriZaki 2 жыл бұрын
thank you!!
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
You're welcome Jake! :-)
@Randomkloud
@Randomkloud Жыл бұрын
how does getline differ from get?
@PortfolioCourses
@PortfolioCourses Жыл бұрын
I think this is a good explanation here: stackoverflow.com/a/55308322. :-)
@ralphordiz6502
@ralphordiz6502 Жыл бұрын
getline doesnt work in codeblocks
@iJuMp8
@iJuMp8 Жыл бұрын
What do you use instead for CodeBlocks?
@naniguini
@naniguini 2 жыл бұрын
Does anyone know how to solve this? I'm making a program that uses getline(cin, string), and even though it builds and runs without problem, it seems to skip this method and do the next steps.
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
Hi Maria, have you tried clearing the input buffer? Sometimes that can help: kzbin.info/www/bejne/nJTcmImqeb2UpK8. 🙂
@naniguini
@naniguini 2 жыл бұрын
@@PortfolioCourses Thank you very much, but it seems this method is not recognized by my IDE (Code::Blocks).
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
Hmm, if it gives you an error message, you could google the error message to try to help. If it just doesn't work and has no error message, then maybe it's not solving the problem in your code. The code for that demo is here, I suspect it should work in Code::Blocks too as it is standard C++: github.com/portfoliocourses/cplusplus-example-code/blob/main/clear_input_buffer.cpp.
@naniguini
@naniguini 2 жыл бұрын
@@PortfolioCourses I solved it, I had to use some libraries. Thank you👍👍
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
@@naniguini Great! 🙂
@LearningCorner2011
@LearningCorner2011 8 ай бұрын
Virat fan
Do-While Loops | C++ Tutorial
11:51
Portfolio Courses
Рет қаралды 1,6 М.
Can You Find Hulk's True Love? Real vs Fake Girlfriend Challenge | Roblox 3D
00:24
Do you love Blackpink?🖤🩷
00:23
Karina
Рет қаралды 21 МЛН
Twin Telepathy Challenge!
00:23
Stokes Twins
Рет қаралды 120 МЛН
How To Choose Mac N Cheese Date Night.. 🧀
00:58
Jojo Sim
Рет қаралды 98 МЛН
PHP Callback Functions
2:20
WebmasterMaze
Рет қаралды 24
31 nooby C++ habits you need to ditch
16:18
mCoding
Рет қаралды 827 М.
How Strings Work in C++ (and how to use them)
19:26
The Cherno
Рет қаралды 468 М.
Member Initializer Lists | C++ Tutorial
23:10
Portfolio Courses
Рет қаралды 9 М.
String In Char Array VS. Pointer To String Literal | C Programming Tutorial
9:58
C++ File Input and Output
10:21
Shmeowlex
Рет қаралды 68 М.
Introduction To Inheritance | C++ Tutorial
9:38
Portfolio Courses
Рет қаралды 23 М.
how Google writes gorgeous C++
7:40
Low Level
Рет қаралды 954 М.
Beginners Should Think Differently When Writing Golang
11:35
Anthony GG
Рет қаралды 124 М.
Reference Variables | C++ Tutorial
12:04
Portfolio Courses
Рет қаралды 4,9 М.
Can You Find Hulk's True Love? Real vs Fake Girlfriend Challenge | Roblox 3D
00:24