Write a c program that creates a union named users

Assignment Help C/C++ Programming
Reference no: EM132095711

Please help!!!

1. Write a C program that creates a structure named student with three members (name, last name and id).
Enter 2 student's information and save it in a txt file.

2. Write a C program that creates a union named "users" with two members (last name and email).
Enter 3 users's information, print it (make sure you print the correct values) and save the correct values in a txt file.

3. What is wrong or missing in this code to avoid errors or warnings?

#include<stdio.h>
#include<conio.h>
void main() {
union details {
struct student st;
};
union details set;
printf("Enter details:");
printf("\nEnter FIrst name : ");
scanf("%s", set.st.first_name);
printf("\nEnter id : ");
scanf("%d", &set.st.id);

printf("\nFirst name : %s", set.st.first_name);
printf("\nId : %d", set.st.id);
getch();
}

4. What is wrong or missing in this code to avoid errors or warnings?

#include <stdio.h>
int main() {
char buff[255];

fp = fopen("C:\\temp\\test1.txt", "r");
fscanf(fp, "%s", buff);
printf("1 : %s\n", buff );

fgets(buff, 255, (FILE*) );
printf("2: %s\n", buff );

return 0;

}

5. Write a program to insert the binary sequence [1 0 0 0 1 0 1 1] in a register named "my_register" using bit fields."

Reference no: EM132095711

Questions Cloud

Determine the coefficient of performance of the refrigerator : The food compartment of a refrigerator is maintained at 4°C by removing heat from it at a rate of 360 kJ/min. If the required power input to the refrigerator.
Prepare a multiple-step income statement for the year ended : Prepare a multiple-step income statement for the year ended December 31, 2014. Compute the gross margin percentage and net profit margin ratio
How many photons are emitted each second : A helium-neon laser emits red light having a wavelength of 6.4 x 10-7 m and a power of 0.5 mW. How many photons are emitted each second?
Evaluate professional practice issues in business research : Evaluate professional practice issues in business research - Evaluate the impact of existing business research in a business environment
Write a c program that creates a union named users : Write a C program that creates a union named "users" with two members (last name and email).
Is momentum conserved in all of the experiments : Is momentum conserved in all of the experiments? Please give a complete description with examples as needed supporting your response.
Discussion assignment-international law : Read the questions below. Then find the information requested about the International Criminal Court (ICC) and the International Court of Justice
Determine the fair value of identifiable net assets : Dennis Company purchases Miles Company for $5,000,000 cash on January 1, 2018. Determine the fair value of identifiable net assets used to record goodwill
What is the polarizing angle for the substance : The critical angle for total internal reflection for a substance is 45o. What is the polarizing angle for this substance?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Additional luggage results in erroneousn amount

The application used to calculate the cost of carrying additional luggage results in erroneousn amount, if the weight of the luggage is a fractional number. Help the development team modify the code snippet so that the cost of carrying additional ..

  Evaluate the restriction of assembly

1. Evaluate the restriction of Assembly. Make all computations and note the value of X and Y. 2. Evaluate Restriction Test. Make all computations and note the value of X and Y.

  Write a for loop that adds the integers

Write a for loop that adds the integers between lo and hi (inclusive), and stores the result in result.

  Design and implement those functions in the ide

Determine the functions that you need to create. Design and implement those functions in the IDE. Your program should provide the following additional functionality.

  Write a program for find greatest common divisor

Write code for a recursive implementation of Euclid's algorithm

  Using powerpoint, word, visio or any other graphical editor

Using Powerpoint, Word, Visio or any other graphical editor that allows you to create shapes and arrows, create a simple flow chart  that provides the functionality for this pseudocode: Write "Enter the price in dollars: " Input Price

  Create two structure variables of type phone

Create two structure variables of type phone. Initialize one and have the user input a number for the other one. Then display both numbers. The interchange might look like this.

  Addition of two matrices

Write a C program that uses functions to perform the following: i) Addition of Two Matrices. ii) Multiplication of Two Matrices

  Explain the two different uses of the keyword virtual

Explain the two different uses of The keyword virtual

  How does using strings like integers alter the o-notation

How does using strings instead of simple types like integers alter the O-notation of operations? Is the ADT given in program 4.7 a first-class ADT? Explain your answer.

  What percentage of the time does the sum of the dots

Determine what percentage of the time does the sum of the dots on the two dice equal 8 in the simulation - Writing a program that generates an accurate output

  Approximately normally distributed

Write a program MakeFile.cpp that creates a file random.dat that contains 200 random numbers where each number is the sum of 12 random values rand( )%9. When we add a sufficient number of uniformly distributed numbers the result is approximately n..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd