C++ Programming Tutorial 24 - String Class and C Strings

preview_player
Показать описание


~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~ SUPPORT ME ~~~~~~~~~~~~~~

🅑 Bitcoin - 3HnF1SWTzo1dCU7RwFLhgk7SYiVfV37Pbq
🅔 Eth - 0x350139af84b60d075a3a0379716040b63f6D3853
Рекомендации по теме
Комментарии
Автор

After all These, Finally I Found This Guy who Teaches Better they 98% Of YouTubers

kavanshah
Автор

My professor really emphasizes about differences of c and c++ style. This is great, I love it! Thank you so much!

emmisae-ueng
Автор

Really good information, thank you Caleb!

ReddoX
Автор

Thanks Caleb I got to take this class next semester and this really helped

ghettoslick
Автор

Thank you Caleb. I have been learning Python for 11 years now. I have always wanted to code in C++ but found it extremely difficult to learn. Viewing your C++ tutorials, I notice now that Python code is translatable to C++. Python uses indents C++ uses {}. I was confused when someone said "this is a method. this is a function" etc. Your statement method, member function and function now makes sense to me. You have done a great job explaining C++. Finally I can start coding in C++.😃

FandangleProductions
Автор

Not working for me. I'm using VS Code and when typing std::string, the string initializer turns red (it didn't in the video). Was wondering if anyone knew how to fix. There were no errors when compiling but nothing was consoled out when using std::cout.

mitchcrevier
Автор

# include <iostream>
#include <string>


int main()
{
std::string response = "General";
std::string response_complete = response + " Kenobi";
response_complete += "...";
std:: cout << response_complete << std::endl;

}

anthonydao
Автор

Hello sir ^^, I'm a freshmen student in CS program here in the Philippines and I would like to borrow the entire content(examples) of these lessons from episode 24 to episode 27 for class presentation about strings. I will cite your channel and the links of these four episodes for legal presentation. thank you in advanced. ^^

RicardoSantos-edns
Автор

I'll give you some advice: if someone strings you along, then they really don't have a lot of class. In all seriousness, these videos are phenomenal; thanks so much for taking the time to make and share them!

PunmasterSTP
Автор

I have not necessarily used C++ much at all, but having used C for most of my programming life and working in the embedded world, I can't say I like this comparison of C++ strings vs C strings presented like C strings are deficient or worse. What you are complaining about - e.g., being unable to assign a c string to a different string - is really more the fact that C puts a lot of the onus of how operations are to happen to the programmer, while this C++ string abstracts that away from you. There are contexts where the abstractions are helpful, but other contexts where what's being done under the hood to allow for these abstractions may not be what you want. C just forces you to be more specific - closer to how the hardware is actually carrying out these operations.

That's not necessarily worse or better or "far superior". It's just a different tool for a different context.

It's like complaining "ah I can't cut down this tree with this darn scalpel (C), let me use this chain saw (C++) instead. much easier to work with."

abdullahalmosalami
Автор

<string> is included in the <iostream> header when you "#include <iostream>", so you don't necessarily need to include "#include <string>" in order to use the string class. However, it is good to note that you do NEED <string> included somewhere, so doing so explicitly in this lesson makes that clear.

risajajr
Автор

It would be better to see how to write into a string in the C style too. You skipped that part but anyways it was a good video.

ironiclove
Автор

218 likes and 0 dislikes
Wow awesome!! 👏

mayank
Автор

If you really want to change a cstring:

#include <cstring>
#include <cstdlib>



char *cstr = (char*) malloc(256);
strcpy (cstr, "This is a string");
strcpy (cstr, "This is another string");
cout << cstr << endl; // This is another string
free(cstr);

boyiscola
Автор

using two commands is getting annoying for me so I created a batch file (I'm on windows) called run.bat and it has (see code below) in it. When I run ./run (using up arrow) it will build and run automatically, really helpful for me. (just make sure to change youtube.cpp to whatever your file is called)

@echo off
cls
g++ youtube.cpp
a.exe

oliverz