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

  Write a c program that multiplies user entered number

Write a C program that multiplies user entered number till product of these numbers reach 1000. Which means the number that is entered multiplies itself until it reaches 1000.

  Convert infix to postfix expression

For every postfix expression there exists a corresponding and uniquely defined infix expression that evaluates to the same number.

  Computes the sum and displays it

Prepare a C++ program that asks the user for an integer n and computes the sum 1^2+2^2+3^2+4^2+....+n^2 and displays it in the output screen.

  Contacts class that contains an array

Create a Friend class that contains a first name, last name, a birthday, and a telephone number. Create a Contacts class that contains an array of Friend as well as the owner's name and cell phone Number.

  What mechanism allows the overloaded subscript operator

What mechanism allows the overloaded subscript operator [] to be used on the left side of an assignment statement, like this: v[2] = 22?

  Can you provide the constructor

Can you provide the constructor, copy constructor, copy assignment operator, destructor, move copy constructor, and move assignment operator on "------" ?

  Checking for a palindrome

For this Programming Activity, you will write a GUI-based program checking for a Palindrome.Turn to Page 959 in your text.Complete Programming Activity 1: Checking for a Palindrome.

  Advantages and disadvantages of programming in a way

What are the advantages and disadvantages of programming in a way that only you can understand versus a way that can be understood by others?

  Program that declares three single dimensional arrays

In the gallons array store the numbers 10.3, 15.7, 14.9, 10.7 and 8.4. Each element of the mpg array should be calculated as the corresponding element of the miles array divided by the equivalent element gallons array; for example mpg[0] = miles [..

  Requires the number of bits for the exponent

Write a program that requires the number of bits for the exponent and significant of a Floating Point representation; then requires two decimal real numbers and an operation either sum

  A c++ program using the concept of function overloading

write a c++ program using the concept of function overloading for the following options : select the options from [1-3], 1- Area of rectangle 2- Area of square 3- Exit ,

  Describe an example of a base

Describe an example of a base and a derived class that shows base-class functions that are overridden in the derived class. Provide the syntax, showing the class definitions of both classes.

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