Тёмный

STRUCTS in C++ explained 🏗️ 

Подписаться
Просмотров 7 тыс.
% 214

#C++ #struct
C++ struct tutorial example explained

Наука

Опубликовано:

 

20 май 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 17   
@BroCodez
@BroCodez 2 года назад
#include struct student{ std::string name; double gpa; bool enrolled = true; }; int main() { student student1; student1.name = "Spongebob"; student1.gpa = 3.2; student student2; student2.name = "Patrick"; student2.gpa = 2.1; student student3; student3.name = "Squidward"; student3.gpa = 1.5; std::cout
@FrederikWollert
@FrederikWollert 3 месяца назад
Awesome Video.
@chfadi2201
@chfadi2201 10 дней назад
You are the best bro ❤❤
@lomvil
@lomvil 25 дней назад
thank you for the video
@usermdv84
@usermdv84 2 месяца назад
can we cout that by using for loop or for each loop?
@salomeshunamon4737
@salomeshunamon4737 Год назад
Do you have a video on how to combine arrays and structs?
@masterali2837
@masterali2837 11 месяцев назад
you can simply ask chat gpt but, #include using namespace std; // Define a struct for a person struct Person { string name; int age; }; int main() { const int arraySize = 3; Person people[arraySize]; // Create an array of structs // Initialize array elements people[0] = {"Alice", 25}; people[1] = {"Bob", 30}; people[2] = {"Charlie", 22}; // Access and print array elements for (int i = 0; i < arraySize; ++i) { cout
@nathankwok1292
@nathankwok1292 2 года назад
Hi
@dzbanekkulka7424
@dzbanekkulka7424 Год назад
Hi
@masterali2837
@masterali2837 11 месяцев назад
Hi
@masterali2837
@masterali2837 11 месяцев назад
Hi
@masterali2837
@masterali2837 11 месяцев назад
Hi
@PSIwolf39
@PSIwolf39 7 месяцев назад
Hi
@PSIwolf39
@PSIwolf39 7 месяцев назад
I spent way too muck time making the code #include #include #include #include #include #include #include // Bro code hasn't taught you about half of these #include statements do and I don't know what they do either lol. struct PartyMember { std::string Name; int AttackPower; int Defense; int EnergyRemaining; int EnergyMax; int HealthPointsRemaining; int HealthPointsMax; std::string EquippedWeapon; bool Alive; int CurrentLevel; std::string Description; }; int Check(char Input); int main (){ PartyMember Ness; Ness.Name = "Ness"; Ness.AttackPower = 101; Ness.Defense = 135; Ness.EnergyRemaining = 89; Ness.EnergyMax = 170; Ness.HealthPointsRemaining = 89; Ness.HealthPointsMax = 192; Ness.EquippedWeapon = "BaseballBat"; Ness.Alive = true; Ness.CurrentLevel = 28; Ness.Description = "A young boy with a wonderful talent for magic."; PartyMember King; King.Name = "King"; King.AttackPower = 78; King.Defense = 92; King.EnergyRemaining = 34; King.EnergyMax = 53; King.HealthPointsRemaining = 57; King.HealthPointsMax = 110; King.EquippedWeapon = "Colt single action army revolver"; King.Alive = true; King.CurrentLevel = 28; King.Description = "A small creature who loves cuddles and is great with firearms."; PartyMember Damian; Damian.Name = "Damian"; Damian.AttackPower = 123; Damian.Defense = 99; Damian.EnergyRemaining = 48; Damian.EnergyMax = 71; Damian.HealthPointsRemaining = 3; Damian.HealthPointsMax = 151; Damian.EquippedWeapon = "The Biter"; Damian.Alive = true; Damian.CurrentLevel = 28; Damian.Description = "A man who used to live a boring life, now out in the wilt traveling in a pack."; PartyMember Gpp; Gpp.Name = "G.P.P"; Gpp.AttackPower = 102; Gpp.Defense = 105; Gpp.EnergyRemaining = 83; Gpp.EnergyMax = 83; Gpp.HealthPointsRemaining = 87; Gpp.HealthPointsMax = 129; Gpp.EquippedWeapon = "Arm Cannon"; Gpp.Alive = true; Gpp.CurrentLevel = 29; Gpp.Description = "A half robot, half wolf hybrid. He's also the father of King. (\"G.P.P\" stands for \"Generic Purple Protogen\")"; bool ClosingProgram = false; char Input; do { std::cout Input; switch(Input) { case '1': std::cout
@user-lyf4isnt7daijobu
@user-lyf4isnt7daijobu 10 дней назад
this is cool broo!
@danaildoganov
@danaildoganov 3 месяца назад
#include struct player{ std::string name; std::string team; int goals; bool playing = true; }; int main () { player player1; player1.name = "Messi"; player1.team = "Inter Miami"; player1.goals = 600; player1.playing = true; player player2; player2.name = "Ronaldo"; player2.goals = 800; player2.team = "Al Nassr"; player2.playing = true; player player3; player3.name = "Ronaldinho"; player3.goals = 400; player3.team = "AC Milan"; player3.playing = false; std::cout
Далее
Подключил AirPods к Xbox
0:45
Просмотров 26 тыс.