IN C PLEASE
Question 16 A. Consider “inclass2.h” header file. Define a structure which can hold the following student information: id, first name, last name, and gpa. Use appropriate header file guards. ( Max size of first and last name is 20, id is 7 and gpa is double).
B. Consider an array of student struct with the MAX_SIZE 10 and a first name. These will be provided as an input to your function. Write a function/method that using the given inputs prints out the ID for all the students with the same first name. INPUTS: The struct array should be declared and initialized in the main function.
The following students information should be used to initialize the first 5 elements of the array
Mary Robin aaa111 4.0
Ada Thorne bbb222 3.9
Mary Gray ccc333 3.8
Arthur Eden ddd444 3.7
Mary Aslani eee555 3.6
A variable should be declared and initialized with the name “Mary” in the main and should be provided to the function in part B of the question as one of the inputs ( to print out the id of the students with the same first name).
Code:
#include<stdio.h>
// structure student to hold student data
struct student{
char *id;
char *firstname;
char *lastname;
double gpa;
};
// method to print all ids having same first name
void same_first_name(char *name ,struct student arr[10]){
for(int i=0;i<5;i++){
if(arr[i].firstname == name){
printf("%s",arr[i].id);
printf("\n");
}
}
}
int main(){
struct student arr[10];
// initializing the data
arr[0].id="aaa111";
arr[0].firstname="Mary";
arr[0].lastname="Robin";
arr[0].gpa=4.0;
arr[1].id="bbb222";
arr[1].firstname="Ada";
arr[1].lastname="Thorne";
arr[1].gpa=3.9;
arr[2].id="ccc333";
arr[2].firstname="Mary";
arr[2].lastname="Grey";
arr[2].gpa=3.8;
arr[3].id="ddd444";
arr[3].firstname="Arthur";
arr[3].lastname="Eden";
arr[3].gpa=3.7;
arr[4].id="eee555";
arr[4].firstname="Mary";
arr[4].lastname="Aslani";
arr[4].gpa=3.6;
// variable to hold the name
char *name="Mary";
// calling the method to print ids with same firstname as our
variable
same_first_name(name ,arr);
return 0;
}

![arr[1].firstname=Ada; arr[1].lastname=Thorne; arr[1].gpa=3.9; arr[2].id=ccc333; arr[2].firstname=Mary; arr[2]. lastna](http://img.homeworklib.com/questions/5fccff00-b37b-11eb-bae7-a33917f50679.png?x-oss-process=image/resize,w_560)
Output:

IN C PLEASE Question 16 A. Consider “inclass2.h” header file. Define a structure which can hold...
A. Consider “inclass2.h” header file. Define a structure which can hold the following student information: id, first name, last name, and gpa. Use appropriate header file guards. ( Max size of first and last name is 20, id is 7 and gpa is double). B. Consider an array of student struct with the MAX_SIZE 10 and a first name. These will be provided as an input to your function. Write a function/method that using the given inputs prints out the...
Write a C++ program that includes the following: Define the class Student in the header file Student.h. #ifndef STUDENT_H #define STUDENT_H #include <string> #include <iostream> using namespace std; class Student { public: // Default constructor Student() { } // Creates a student with the specified id and name. Student(int id, const string& name) { } // Returns the student name. string get_name() const { } // Returns the student id. int get_id () const { } // Sets the student...
Files given in this assignment (right-click on the file to download) Assignment7.cpp (need to complete) Student.h (Given. Just use it, don't change it!) Student.cpp (Partially filled, need to complete) 1. Assignment description In this assignment, you will write a simple class roster management system for ASU CSE100. Step #1: First, you will need to finish the design of class Student. See the following UML diagram for Student class, the relevant header file (class declaration) is given to you as Student.h,...
1. Create a file that contains 3 rows of data of the form: First Name Middle Name Last Name Month Day Year Month Day Year GPA. This file represents student data consisting of first name, middle name, last name, registration month, registration day, registration year, birth month, birth day, birth year, current gpa. ...or you may download the data file inPut.txt. inPut.txt reads: Tsia Brian Smith 9 1 2013 2 27 1994 4.0 Harper Willis Smith 9 2 2013 9...
c++ The program will be recieved from the user as input name of an input file and and output.file. then read in a list of name, id# and score from input file (inputFile.txt) and initilized the array of struct. find the student with the higher score and output the students info in the output file obtain the sum of all score and output the resurl in output file. prompt the user for a name to search for, when it find...
For C++ Create a student structure that has fields for first name, last name, hometown, state, year in college and major. Keep the number of students to a reasonabe level. Place each structure into an array sorted by last name and within last name, by first name. Read the student information from a file and print the sorted array to the screen and then to an output file. I was using the code below to guide me but it keeps...
Define a class called Student with ID (string), name (string), units (int) and gpa (double). Define a constructor with default values to initialize strings to NULL, unit to 0 and gpa to 0.0. Define a copy constructor to initialize class members to those of another Student passed to it as parameters. Overload the assignment operator (=) to assign one Student to another. Define a member function called read() for reading Student data from the user and a function called print()...
Program in C Student Data using Structs In this assignment you will create a program (using multiple .c files) to solve the following problem: You have been hired by the university to create a program that will read in input from a .txt file. This input will contain a student name, student id #, their age and their current gpa. You should use the following struct for your student data: struct Student{ char name[50]; int id; float...
In header file (.h) and c++ file format (.cpp). A local company has asked you to write a program which creates an Employee class, a vector of Employee class objects, and fills the objects with employee data, creating a "database" of employee information. The program allows the user to repeatedly search for an employee in the vector by entering the employee's ID number and if found, display the employee's data. The Employee_C class should have the following data and in...
PROGRAM DESCRIPTIONIn this project, you have to write a C++ program to keep track of grades of students using structures and files.You are provided a data file named student.dat. Open the file to view it. Keep a backup of this file all the time since you will be editing this file in the program and may lose the content.The file has multiple rows—each row represents a student. The data items are in order: last name, first name including any middle...