initially our teacher gave this as an example.
told us to check to see if it works,
internet was slow so we ended the class, but i kept working on it
#include <iostream>
#include <stdio.h>
using namespace std;
class structure{
typedef struct{
char firstname[20];
char lastname[20];
int age;
} student_info;
int main (){
student_info students[0];
students[0] = { "Wang", "Dong", 18};
Students[1] = { "wong", "Dang",19};
Cout<<"The record of the first student contains"<<student[0].irstname<<student[0].lastname<<student[0].age;
Return 0;
}};
at first try, it failed an gave this error message:
"
data structures and algorithms\test\main.cpp|9|error: expected unqualified-id before '[' token|
data structures and algorithms\test\main.cpp|10|error: expected unqualified-id before '[' token|"
fixed that as it appears above
then tried again and this appeared
"||=== Build: Debug in test (compiler: GNU GCC Compiler) ===|
data structures and algorithms\test\main.cpp||In member function 'int structure::main()':|
data structures and algorithms\test\main.cpp|18|warning: extended initializer lists only available with -std=c++11 or -std=gnu++11|
data structures and algorithms\test\main.cpp|18|warning: extended initializer lists only available with -std=c++11 or -std=gnu++11|
data structures and algorithms\test\main.cpp|18|error: no match for 'operator=' (operand types are 'structure::student_info' and '<brace-enclosed initializer="" list="">')|
data structures and algorithms\test\main.cpp|13|note: candidate: structure::student_info& structure::student_info::operator=(const structure::student_info&)|
data structures and algorithms\test\main.cpp|13|note: no known conversion for argument 1 from '<brace-enclosed initializer="" list="">' to 'const structure::student_info&'|
data structures and algorithms\test\main.cpp|19|error: 'Students' was not declared in this scope|
data structures and algorithms\test\main.cpp|19|warning: extended initializer lists only available with -std=c++11 or -std=gnu++11|
data structures and algorithms\test\main.cpp|21|error: 'Cout' was not declared in this scope|
data structures and algorithms\test\main.cpp|21|error: 'student' was not declared in this scope|
data structures and algorithms\test\main.cpp|23|error: 'Return' was not declared in this scope|
data structures and algorithms\test\main.cpp|24|warning: no return statement in function returning non-void [-Wreturn-type]|
||=== Build failed: 5 error(s), 4 warning(s) (0 minute(s), 0 second(s)) ===|
"
i thinks its coming from "iostream" i don't know how or why?
What I have tried:
i'm new so i don't know what this box is for,but it's required so...