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
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
#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
shoutout to this channel for teaching me when my professor doesnt
Awesome Video.
thank you for the video
You are the best bro ❤❤
can we cout that by using for loop or for each loop?
Yeah we can
Do you have a video on how to combine arrays and structs?
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
This is the exact same thing as a class
Hi
Hi
Hi
Hi
Hi
Hi
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
this is cool broo!
#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