Question

In: Computer Science

Remember we're only using C to program this. That does not mean C++, just no! This...

Remember we're only using C to program this. That does not mean C++, just no!

This one's long so pay attention. You are going to create a structure that resembles a university’s profile (Any university name is ok, just pick one). This structure must contain 5 members. They are listed here:

1. One member for number of undergraduate students

2. One member for number of graduate students

3. One member for number of classrooms

4. One member for the name of the university (use an array)

5. One member for the term (fall, summer or spring; also an array)

Once you define a structure with these members (make sure your array's have a default length), you will declare one structure of this type in main. Then, also inside main, initialize the members that aren’t arrays. Next, you are going to ask the user for the estimated lengths of the other two members. In an example here, “How many letters do we expect for the name of the university?”. When you receive these two values (one for each array), be sure to check that they do not surpass the default length you gave to each array. If any of these two happen to surpass the default lengths, you will print out a message and exit the program (this will all be done in main).

Now, if the program didn’t end, the next step is to initialize the arrays with the help of a function. You must initialize one array at a time (keep in mind that these arrays are members of a structure, so you will have to manipulate them a little different than before, but it is do-able). This function will not return anything and it will accept an array. Inside the function, you will scan for a set of characters given by the user. Lastly, indicate the user to end with a "dot" (you must recall what a "dot" is in terms of programming).

Call this function twice, the first time for the University’s name, and the second time for the term (spring, summer, or fall). Once you have called this function two times, your structure will be fully initialized. Now all that is needed, is to print out all the members. You are going to print the non-array members. Then, use a function to print out the array members (like before you will also have to call this function twice; once for the University’s name and once for the term). This function should not return anything, but it should accept an array.

Solutions

Expert Solution

In the below we have define a structure and its given mambers.

Define functions to initialize the array and print the array

This is the whole code of the given problem.


Related Solutions

only using C (not C++) Implement a program that counts the words and prints their frequencies....
only using C (not C++) Implement a program that counts the words and prints their frequencies. In particular, the program extracts “words” from one or more text files, from a pipe, or from the console, and prints to the console the list of words found and their associated frequencies. Note that your project submission is restricted to only using the following system calls: open(), close(), read(), write(), and lseek() for performing I/O. You are allowed to use other C library...
(MUST BE DONE IN C (NOT C++)) For this program, remember to use feet and inches....
(MUST BE DONE IN C (NOT C++)) For this program, remember to use feet and inches. First, ask the user for the name of students they have in their class. Then, using a loop, you will ask for each student’s height. However, you will have to use two separate variables, one for feet and one for inches. Then, you will have to call two functions. The first function will check if the values entered are valid (check if number of...
Writing a squareroot program in C++ using only: #include <iostream> using namespace std; The program must...
Writing a squareroot program in C++ using only: #include <iostream> using namespace std; The program must be very basic. Please don't use math sqrt. Assume that the user does not input anything less than 0. For example: the integer square root of 16 is 4 because 4 squared is 16. The integer square root of 18 is 5 because 4 squared is 16 and 5 squared is 25, so 18 is bigger than 16 but less than 25.  
Writing an nth root program in C++ using only: #include using namespace std; The program must...
Writing an nth root program in C++ using only: #include using namespace std; The program must be very basic. Please don't use math sqrt or pow . For example, the 4th root of 16 is 2 because 2 * 2 * 2 * 2 = 16. The 4th root of 20 is 2 because 2 * 2 * 2 * 2 = 16 and 16 is less than 20, and 3 * 3 * 3 * 3 = 81, which...
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...
Write a program in c++ using only if statements that prompts the user to enter an...
Write a program in c++ using only if statements that prompts the user to enter an integer for today’s day of the week (Sunday is 0, Monday is 1 …., and Saturday is 6) then displays today. Also, prompt the user to enter the number of days after today for a future day and display the future day of the week. The future day can be computed as follows: (today + number of days after today) % 7 Sample run...
Given a queue of integers, write an algorithm and the program in c++ that, using only...
Given a queue of integers, write an algorithm and the program in c++ that, using only the queue ADT, calculates and prints the sum and the average of the integers in the queue without changing the contents of the queue.
C# CODE C# 1) Write a program that calculates a student's GPA. Remember, an A is...
C# CODE C# 1) Write a program that calculates a student's GPA. Remember, an A is worth 4 points, a B is worth 3 points, a C is worth 2 points, a D is worth 1 point, and an F is worth 0 points. For the purposes of this assignment, assume that all classes carry the same number of credit hours. 2) Use a sentinel-controlled loop to gather a variable number of letter grades. This should terminate the loop if...
In C++ Please, using only the libraries given in this homework prompt, Write a program that...
In C++ Please, using only the libraries given in this homework prompt, Write a program that (1) prompts for two integers, (2) prints out their sum, (3) prints out the first divided by the second, and (4) prints out the natural log of the first number raised to the power of the second number. #include <iostream> #include <iomanip> using namespace std; int main() { <your answer goes here> return 0; }
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:...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT