Question

In: Computer Science

Be sure to use only C for the Programming Language in this problem. Before we start...

Be sure to use only C for the Programming Language in this problem.

Before we start this, it is imperative that you understand the words “define”, “declare” and “initialize” in context of programming. It's going to help you a lot when following the guidelines below.

Let's begin! Define two different structures at the top of your program. be sure to define each structure with exactly three members (each member has to be a different datatype). You may set them up however you want (so long as it runs without issue of course). Remember to use semicolons.

- Inside main, declare two structures. One for each of the two structures you defined.

- Then, initialize each one of the members manually (the three members of your first structure and the three elements of your second structure).

- Lastly, print out all six members with their respective message.

Solutions

Expert Solution

#include <stdio.h>
/*Defining the Structure1*/
struct Company
{
  int cregistration_no;
  char *cname;
  int cphone_number;
};

/*Defining the Structure2*/
struct Employee
{
  int eid_no;
  char *ename;
  int ephone_number;
};


int main()
{
  
     /* Here company is the variable of structure Company*/
     struct Company company;

     /*Now we are assigning the values of each struct member here*/
     company.cregistration_no = 12345;
     company.cname = "Apple";
     company.cphone_number = 234567;
     
     
     /* Here employee is the variable of structure Employee*/
     struct Employee employee;

     /*Now we are assigning the values of each struct member here*/
     employee.eid_no = 142134;
     employee.ename = "Sumit Kumar";
     employee.ephone_number = 236785;
     
     

     /*Now we are going to displaying the values of struct members */
     printf("Registration number of company  is: %d", company.cregistration_no);
     printf("\n Company name  is: %s", company.cname);
     printf("\ncompany Phone Number is: %d", company.cphone_number);
     
     
     /*Now we are going to displaying the values of struct members */
     printf("\n\n\nEmployee id  is: %d", employee.eid_no);
     printf("\n Employee name  is: %s", employee.ename);
     printf("\nEmployee Phone Number is: %d", employee.ephone_number);
    return 0;

    
  
}


Registration number of company  is: 12345
Company name  is: Apple
company Phone Number is: 234567


Employee id  is: 142134
Employee name  is: Sumit Kumar
Employee Phone Number is: 236785





Please refer to the screenshoot of the code too understand the indentation of the code.


Related Solutions

Only Program in C for this. No other programming language is allowed. Using a function, we...
Only Program in C for this. No other programming language is allowed. Using a function, we will add a range of values of an array. The range is going to be determined by the user. In this example, if you put the following array down as: 1.5 -5.6 8.9 4.6 7.8 995.1 45.1 -5964.2 … and the user tells you to add from the 3rd element to the 6th element, your program is going to need to add the values:...
C Programming Language (Code With C Programming Language) Problem Title : Which Pawn? Jojo is playing...
C Programming Language (Code With C Programming Language) Problem Title : Which Pawn? Jojo is playing chess himself to practice his abilities. The chess that Jojo played was N × N. When Jojo was practicing, Jojo suddenly saw a position on his chessboard that was so interesting that Jojo tried to put the pieces of Rook, Bishop and Knight in that position. Every time he put a piece, Jojo counts how many other pieces on the chessboard can be captured...
Instructions: 1. Please use only C as the language of programming. 2. Please submit the following:...
Instructions: 1. Please use only C as the language of programming. 2. Please submit the following: (1) the client and the server source files each (2) a brief Readme le that shows the usage of the program. 3. Please appropriately comment your program and name all the identifiers suitable, to enable enhanced readability of the code. Problem: Write an ftp client and an ftp server such that the client sends a request to ftp server for downloading a file. The...
The Programming Language is C++ PLEASE, Make sure to read the requirements and grading criteria for...
The Programming Language is C++ PLEASE, Make sure to read the requirements and grading criteria for homework first... Thank you!!! Objective: The purpose of this project is to expose you to: One-dimensional parallel arrays, input/output, Manipulating summation, maintenance of array elements. In addition, defining an array type and passing arrays and array elements to functions. Problem Specification: Using the structured chart below, write a program to keep records and print statistical analysis for a class of students. There are three...
You are using ONLY Programming Language C for this: In this program you will calculate the...
You are using ONLY Programming Language C for this: In this program you will calculate the average of x students’ grades (grades will be stored in an array). Here are some guidelines to follow to help you out: 1. In your program, be sure to ask the user for the number of students that are in the class. The number will help in declaring your array. 2. Use the function to scan the grades of the array. To say another...
Solve for number 2, Use Functional Programming ONLY, so No For loops Use JavaScript: Start with...
Solve for number 2, Use Functional Programming ONLY, so No For loops Use JavaScript: Start with an array called inputtable. The array should have numbers between 1 and 10. NOTE: Do NOT use a form of a ‘for’ loop anywhere, including iterators. This is meant to be a functional exercise. Get the odd multiples of 5 between 1 and 100. 5, 15, …
In the R programming language, we would like to use the data set called iris to...
In the R programming language, we would like to use the data set called iris to build a simple linear regression model to predict Sepal.Length based on Petal.Length. Calculate the least squares regression line to predict Sepal.Length based on Petal.Length. Interpret the slope of the line in the context of the problem. Remember that both variables are measured in centimeters. Plot the regression line in a scatterplot of Sepal.Length vs. Petal.Length. Test H1: ??1 ≠ 0 at ?? = 0.05...
Problem: Make linkedList.h and linkList.c in Programming C language Project description This project will require students...
Problem: Make linkedList.h and linkList.c in Programming C language Project description This project will require students to generate a linked list of playing card based on data read from a file and to write out the end result to a file. linkedList.h Create a header file name linkedList Include the following C header files: stdio.h stdlib.h string.h Create the following macros: TRUE 1 FACES 13 SUITS 4 Add the following function prototypes: addCard displayCards readDataFile writeDataFile Add a typedef struct...
Please answer the problem below in C programming language: Create a pointer activity source file -...
Please answer the problem below in C programming language: Create a pointer activity source file - cptr2.c - that takes two arguments, a number from 1 to 3, and a string sentence(s). Create variables for a character, an integer, a string pointer. Based on integer value you will use that number of string pointers. The string variable is a string pointer that has not been allocated.    Define pointers to those variables types without any initialization of those points to the...
C Programming use notes Start by asking the user how many grades are to be entered....
C Programming use notes Start by asking the user how many grades are to be entered. Then ask for each one of theses grades. Calculate the average grade and the number of failing grades (grade less than 70). Display on the screen the average grade and the number of failing grades
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT