Hello, My class is over but I want to figure out how to print from a structure. In my program the first 28 lines were the example frrom the instructor on structures. He did not show us how to print the structure to teh screen. I have been trying a few things and have not gotten them to work. Right now it complies and asks for the info to put into the structure but does not print it out. I am just wanting to expand my knowledge. Thank you for the help
#include <iostream>
using namespace std;
typedef struct
{
char name [100];
int age;
char power [100];
}SuperHero;
int main ()
{
int count;
SuperHero my_hero [3]; //creates array of 3 superheros
for (int x = 0; x < 3; x++)
{
cout << "Enter name" << endl;
cin >> my_hero [x].name; // stores super heros name into name. x is the number of the location for each superhero 1,2,3
cout << "Enter age" << endl;
cin >> my_hero[x].age;
cout << "Enter power" << endl;
cin >> my_hero[x].power;
for (int x=0; count <= 3; count++)
{
cout << "Name: " << my_hero[x].name << endl;
cout << "Age: " << my_hero[x].age << endl;
cout << "Power: " << my_hero[x].power << endl;
}
}
}