
please help!!! this is VMware Workstation, thank you!
Coment if you have any doubts
Code:
#include<stdio.h>
// Emplyoe structure definition with 4 members
struct emp{
int id; // employee id
char name[50]; // name of employee
float salary; // salaray of emplyoee
char gender; // gender either M F
};
main(){
int len=13;
// declaring array of emp struct with length
struct emp google_emp[len];
// declaring file pointer
FILE *fp;
// opening file inread mode
// fopen(filename,mode) mode = r,w,a etc..
fp=fopen("data.txt","r");
// data varaiables
int index=0,i;
// Accessing data from file and copyinf it into struct array
// feof() returns non zero value if end of file has reached otherwise 0
while(!feof(fp)){
// fscanf() is used to get data from file
fscanf(fp,"%d %s %f %c",&google_emp[index].id,google_emp[index].name,&google_emp[index].salary,&google_emp[index].gender);
index++;
}
// displaying the data in terminal
for(i=0;i<len;i++)
printf("%d %s %f %c\n",google_emp[i].id,google_emp[i].name,google_emp[i].salary,google_emp[i].gender);
fclose(fp);
}
Screenshot:
![#include<stdio.h> // EmpLyoe structure definition with 4 members 3 struct emp{ 4 int id; // employee id char name[50]; // nam](http://img.homeworklib.com/questions/a31bc7a0-00d4-11eb-b833-03c71ae181a7.png?x-oss-process=image/resize,w_560)
output:

data.txt:

please help!!! this is VMware Workstation, thank you! Create a c program of your choosing that...
Create a c program of your choosing that follows the specifications below: Define a struct with 4 or more members. The struct must be different from the ones used in class (20 points) Declare an array of your struct using a size of 10 or more (20 points) Load the data for each element in your array from a text file (20 points) Display the data in your array in the terminal (20 points) Provide brief comments for every line...
C
program
Main topics: Files Program Specification: For this assignment, you need only write a single-file C program. Your program will: Define the following C structure sample typedef struct int sarray size; the number of elements in this sanple's array floatsarray the sample's array of values sample Each sample holds a variable number of values, all taken together constitute a Sample Point Write a separate function to Read a file of delimited Sample Points into an array of pointers to...
Write a program that demonstrates use of programmer - defined
data structures. Please provide code! Thank you.
Here are the temps given:
January 47 36
February 51 37
March 57 39
April 62 43
May 69 48
June 73 52
July 81 56
August 83 57
September 81 52
October 64 46
November 52 41
December 45 35
Janual line Iranin Note: This program is similar to another recently assigned program, except that it uses struct and an array of...
Problem Specification:Write a C++ program to calculate student’s GPA for the semester in your class. For each student,the program should accept a student’s name, ID number and the number of courses he/she istaking, then for each course the following data is needed the course number a string e.g. BU 101 course credits “an integer” grade received for the course “a character”.The program should display each student’s information and their courses information. It shouldalso display the GPA for the semester. The...
Use two files for this lab: your C program file, and a separate text file containing the integer data values to process. Use a while loop to read one data value each time until all values in the file have been read, and you should design your program so that your while loop can handle a file of any size. You may assume that there are no more than 50 data values in the file. Save each value read from...
The language is C++. Code needs to be added to line 28 and 37.
Could someone provide some help with how to do it?
CODE
Write a program to unscramble words A file with list of words is provided along with a template program to get you started. 1. Define a struct with 2 string members: sorted and original 2. Declare an array of 200000 elements with data type of the struct 3. Read from a file a list of...
Program in C++! Thank you in advance! Write a menu based program implementing the following functions: (1) Write a function that prompts the user for the name of a file to output as a text file that will hold a two dimensional array of the long double data type. Have the user specify the number of rows and the number of columns for the two dimensional array. Have the user enter the values for each row and column element in...
Need help building this C++ program For your program you will create a class that represents square shapes. I provide you an incomplete client program that will test your class and an incomplete header file where you have to declare and implement the class. In the client program you have to complete certain statements according to the indications provided in the corresponding comments. In the header file you have to create class square according to the following specifications: Member functions...
C++ Array Expander and Element Shifter Thank you so much to anybody that can help! Here are our two homework prompts: PART A: Array Expander Write a function that accepts an int array and the array’s size as arguments. The function should create a new array that is twice the size of the argument array. The function should copy the contents of the argument array to the new array and initialize the unused elements of the second array with 0....
Need the c code please, also please only use <stdio.h>
library. Simple code please
Define a struct with teg Capacitor that holds the following Information about a capacitor: Model number (e.g. 11-123U), capacitance (e.g. 1000 u.f), voltage (e.g. 2.5 V), cost {$6.50} Create your main program file capacltorsInfac. Declare two variables of type struct Capacitor and populate them with the following values: First' variable: model Is 11-123U, capacitance Is 100, voltage Is 25 and cost Is $6.00 Second variable: model...