C++ Tutorial 2: Variables and Operators

preview_player
Показать описание
This video talks about the basic tools for storing data and processing it.
Рекомендации по теме
Комментарии
Автор

One small derp, you called the forward slash for division a backslash. You drew it correctly so it must just be tiredness :)

tabularasa
Автор

in java they're objects, but in c++ string is a keyword. in c++ a "string" is essentially a "char[]", but it is a type nonetheless

SamBrev
Автор

How do you concatenate string variables in C++? I can concatenate strings, but when I store strings in variables and then concatenate them in the cout statement I get a confusing error message. Here's what I've written:

string name = "World";
cout << "Hello, " << name << "!" << endl;

And I get a weird error that says no operator "<<" matches these operands.

BYoshi
Автор

Loads of info and "yeah's "  ;) :D

johnbounds
Автор

when you were talking about variable types you missed them out, and i'm pretty sure they're very commonly used.

SamBrev
Автор

yes, but a string functions like a char array in every way. you can find a char in a string by calling string[int] - the same as a char array. you can get the length by going string.length - the same as a char array. they are practically the same in c++

SamBrev
Автор

dinosaur Babies are the tax collectors of the past

chiligy
Автор

Ah, no, they are both in C++. You can use char* or std::string.

WarehouseC