Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For C++ in visual studio Write a program or function for each of the following.

ID: 665558 • Letter: F

Question

For C++ in visual studio

Write a program or function for each of the following. If you write a function, make sure you have a main program that tests the function. Include code and a sample run for each problem.

Write a program that 3creates a structure (a C struct) to hold student information. The information should include Last Name, First Name, Number of credits completed, and Date of enrollment. The main program should allow the user to enter information on a student and then print out the information that was entered.

Explanation / Answer

the whole structure is passed to another function by value. It means the whole structure is passed to another function with all members and their values. So, this structure can be accessed from called function. This concept is very useful while writing very big programs in C

#include <stdio.h>
#include <string.h>
// Last Name, First Name, Number of credits completed, and Date of enrollment.

struct student
{
            int id,credits_comp;
            char fname[20],lname[20],dateofEnr[20];
            float percentage;
};

void func(struct student record);

int main()
{
            struct student record;

            record.id=1;
            strcpy(record.fname, "Raju");
           strcpy(record.lname, "david");
            record.credits_comp=4;
           strcpy(record.dateofEnr, "aug82015");
            record.percentage = 86.5;

            func(record);
            return 0;
}

void func(struct student record)
{
            printf(" Id is: %d ", record.id);
            printf(" Name is: %s ", record.fname"+"record.lname);
           printf(" credits completed ",record.credits_comp);
           printf("Date of enroll ment ",record.dateofEnr);
            printf(" Percentage is: %f ", record.percentage);
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote