im starting to learn c++ and im looking at arrays and structures i wrote this code earlier but i seem to be getting lots of errors when I try to compile (im using code blocks btw)
#include <iostream>
usingnamespace std;
struct scoreboard
{
char gamertag[20];
int kills;
int deaths;
int score = kills * 50;
float kdRatio = kills / deaths;
};
int main ()
{
scoreboard gamers[5]=
{
{ "juanbenavid", 68 , 10 ,}
};
cout<< gamers[0].kdRatio << "\n";
cout<< gamers[0].score;
}
Its basically just a test run of using an array of structures, each element in the array contains a structure of the players gamertag, kills, deaths, score, and kdRatio. Everytime i compile i get like 9 errors. as far as i can understand the error is when the program tries to find the kdratio and score. im not sure if im allowed to make operations like that inside a structure using its members but i dont know of any other to go about this. if anyone could help me understand where im wrong and how i could fix it it would be very apreciated.