Question: Extend the code below using online GDB that simulates and prints user login records so that the information about the user's terminal is also stored

Extend the code below using online GDB that simulates and prints user login records so that the information about the user's terminal is also stored in the file and then printed. Your program output should look like this:
user_0 last logged in on terminal_10 on Mon Jun 313:10:532024
user_1 last logged in on terminal_11 on Mon Jun 313:10:542024
user_2 last logged in on terminal_11 on Mon Jun 313:10:552024
You are not allowed to use any file IO functions other than the system calls discussed in class.
Submit a single C source code file with your work and a screenshot (in PNG or JPG format) showing the results of executing your program.
// using structures in C
#include
#include
struct dataRecord {// a simple structure to represent a person
int intID;
int intAge;
float fSalary;
char strName[100];
};
// print the values of a structure
void printDataRecord(const struct dataRecord * p){
printf("%s is %d years of age, their salary is %f.
",
p->strName, p->intAge, p->fSalary);
}
int main(){
struct dataRecord John; // declare an instance of a structure
John.intID=12345;
John.intAge=25;
John.fSalary=100.05;
strcpy(John.strName,"John");
printDataRecord(&John);
John.intAge=26; // change one field within a structure
struct dataRecord *alias=0;
alias=&John; // create a pointer to a structure
alias->fSalary=110; // access a field within a structure via a pointer
printDataRecord(&John);
(*alias).fSalary=115;
printDataRecord(alias);
return 0
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!