- 2

C ++ application the name "DataStructures", which uses a structure (struct) named "Student" of multiple data, with elements:

studentid: int type name: string type gender: char type (only accepts "m" or "f") stature: float type state: boolean type The application should have a menu (similar to the array exercise) with the following options: Structure filling Structure printing Test the application and correct the errors, before continuing with the following points. After the structure is finished and working, modify the application to use a data structure arrary. Modify the menu with the following options: Structure definition (how many elements will the structure type arrangement have) Filling of the structure type arrangement Structure type arrangement printing The application should ask how many elements the arrangement will have Fill and print the structure with 5 elements. #include <iostream> using namespace std; struct alumnos; int numero; char caracter, nombre[15]; float promedio, estatura; } alumno1={"147893",alejandro, 1.70}, alumno2={"524248"},mariano, 1.52}, return 0; This is test but it still marks error

25th May 2021, 5:20 AM
Marcos P.
2 Réponses
+ 1
Your Structure syntex is not correct after decleration of struct u missed bracket then after closing brac u missed semicolon and your main function is also missing inside main u have to create object alumno or u can give anyone which u want . This is the code you can see how to declear struct and how to access members /* #include <iostream> using namespace std; struct Student { char name[50]; int age; float salary; }; int main() { Student p1; cout << "Enter Full name: "; cin.get(p1.name, 50); cout << "Enter age: "; cin >> p1.age; cout << "Enter salary: "; cin >> p1.salary; cout << "\nDisplaying Information." << endl; cout << "Name: " << p1.name << endl; cout <<"Age: " << p1.age << endl; cout << "Salary: " << p1.salary; return 0; } */
25th May 2021, 5:46 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
Sorry
25th May 2021, 5:32 AM
Marcos P.