here we take file name as input_csv.txt. It is considered as text file.
here on output screen one line gives one record of individual student.
/* PROGRAM */
#include <stdio.h>
#include <stdlib.h>
#include<string.h>
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
typedef struct
{
char name[50];
int id;
char dept[20];
double cgpa;
}student;
int main()
{
FILE *fptr;
student std[100];
char s[80];
char rec[100][100];
double rec1[100][100];
char filename[100];
double d;
string s1;
int i,j,n,l,c=0,k=0,p,x,m=0,r,h=0,u=0;
c=0;
i=0;
k=0;
fptr = fopen("input_csv.txt", "r");
if (fptr == NULL)
{
printf("Cannot open file \n");
exit(0);
}
while(fgets(s,1000,fptr)!=NULL)
{
m=0;
u=0;
m=0;
h=0;
s1="";
k=0;
c=0;
l=strlen(s);
i=0;
while(i<l)
{
if(s[i]==',')
{
while(k<c)
{
s1=s1+s[k];
k++;
}
if(m==1)
{
rec1[u][0]=atoi(s1.c_str());
u++;
}
else strcpy(rec[m], s1.c_str());
m++;
p=0;
i++;
k++;
c++;
s1="";
}
else if(i==l-1)
{
while(k<=c)
{
s1=s1+s[k];
k++;
}
if(m==3)
{
rec1[u][0]=atof(s1.c_str());
u++;
}
else strcpy(rec[m], s1.c_str());
m++;
p=0;
i++;
k++;
c++;
s1='\0';
}
else
{
i++;
c++;
}
}
strcpy(std[h].name,rec[0]);
std[h].id=rec1[0][0];
strcpy(std[h].dept,rec[2]);
std[h].cgpa=rec1[1][0];
printf("%s %d %s
%0.2f\n",std[h].name,std[h].id,std[h].dept,std[h].cgpa);
}
fclose(fptr);
}
SCREEN SHOT

![while(fgets(5,1000, fptr)!=NULL) m= ; u=0; ni=0; h=0; $1= k= ; C= ; 1=strlen(s); i=0; while(i<l) if(s[i]==,) while(k<c) s](http://img.homeworklib.com/questions/d177ff60-98a0-11eb-95e1-b9ce95038870.png?x-oss-process=image/resize,w_560)
![p=0; i++; s1=; else if (i==1-1) while(k<=c) s1=51+s[k]; k++; if (m==3) rec1[u][@]=atof(s1.c_str(); ++; else strcpy(rec[m],](http://img.homeworklib.com/questions/d1ca9800-98a0-11eb-8ca2-3b586e92bac0.png?x-oss-process=image/resize,w_560)
![else i++; C++; strcpy(std[h]-name, rec[@]); std[h].id=rec1[@][@]; strcpy(std[h].dept,rec[2]); std[h] .cgpa-rec1[1][@]; printf](http://img.homeworklib.com/questions/d212b100-98a0-11eb-9c14-8592d1544f5a.png?x-oss-process=image/resize,w_560)
when file is

OUTPUT

when file is:

Output

C Program: Write a program that will read names, ids, dept names, and cgpа of some...
In c programming
.
Part A: Writing into a Sequential File Write a C program called "Lab5A.c" to prompt the user and store 5 student records into a file called "stdInfo.txt". This "stdInfo.txt" file will also be used in the second part of this laboratory exercise The format of the file would look like this sample (excluding the first line) ID FIRSTNAME LASTNAME GPA YEAR 10 jack drell 64.5 2018 20 mina alam 92.3 2016 40 abed alie 54.0 2017...
//Done in C please!
//Any help appreciated!
Write two programs to write and read from file the age and first
and last names of people. The programs should work as follows:
1. The first program reads strings containing first and last
names and saves them in a text file (this should be done with the
fprintf function). The program should take the name of the file as
a command line argument. The loop ends when the user enters 0, the...
In C++
Write a menu driven C++ program to read a file containing
information for a list of Students, process the data, then present
a menu to the user, and at the end print a final report shown
below. You may(should) use the structures you developed for the
previous assignment to make it easier to complete this assignment,
but it is not required.
Required Menu Operations are:
Read Students’ data from a file to update the list (refer to
sample...
C++ Write a program that reads students’ names followed by their test scores from the given input file. The program should output to a file, output.txt, each student’s name followed by the test scores and the relevant grade. Student data should be stored in a struct variable of type StudentType, which has four components: studentFName and studentLName of type string, testScore of type int and grade of type char. Suppose that the class has 20 students. Use an array of...
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...
Using the program segment and sample txt file below, write a program that contains a linked list of students. The program should allow the user to: 1. initialize list of students 2. add additional student to front of list 3. add additional student to rear of list 4. delete student 5. sort students alphabetically 6. sort students by idNum 7. show number of students in list 8. print students 9. quit program XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX The program should be divided into the...
Part1. Write a C program contains the following declarations: char customer_name[N_CUSTOMERS][MAX_NAME_LENGTH]; int customer_number[N_CUSTOMERS] A program uses a text file that contains the following data on each line: The customer number is an int, and the first and last names are alphabetic strings that contain no whitespace. The last and first names themselves are however separated by whitespace. Write a C function with the following prototype: void read_customer (char name[][MAX_NAME_LENGTH], int number[], int position, FILE *cust_file) Your function should read a...
In C. I want to read in the data of a text file into an array of dynamically allocated structs. The file is read as a command-line argument The text file format is: <number of classes in this file> <department name of class 1>:<number of class 1>:<location of class 1> <department name of class 2>:<number of class 2>:<location of class 2> ... Assume that no piece of information in the file contains a colon: the colons are only used as...
Write a complete C++ program that reads students names and their test scores from an input text file. The program should output each student’s name followed by the test scores and the relevant grade in an output text file. It should also find and display on screen the highest/lowest test score and the name of the students having the highest/lowest test score, average and variance of all test scores. Student data obtained from the input text file should be stored...
Using c++ Write a program that reads in a list of up to 25 first names from an input file nameData.txt and allows the user to display the name data, sort it in ascending or descending order, count the number of occurrences of a given name, or exit the program. The input file consists of a single names per line with each line terminated with an end of line (i.e. using Enter key to end the line). Your program should...