Declare an array of 40 student_t structures, and write a code segment that displays on separate lines the names (last name, first name) of all the students in the list. IN C
Hi there,
The code :
#include<stdio.h>
typedef struct{
char first[50]; //to store first
name
char last[50]; //to store last name
}student_t;
int main()
{
student_t stud[40];
for(int i=0;i<40;i++)
{
printf("\nEnter the first name for
student %d : ",i+1);
scanf("%s",stud[i].first); //input first name
printf("\nEnter the last name for
student %d : ",i+1);
scanf("%s",stud[i].last); //input last name
printf("\n");
}
for(int i=0;i<40;i++)
{
printf("\n%s
%s",stud[i].first,stud[i].last); //print the complete
name
}
printf("\n");
return 0;
}
The code(screenshot) :
The output(screenshot) :(4 inputs only)
Thank you.
Happy Coding :)
Declare an array of 40 student_t structures, and write a code segment that displays on separate...
Using C Programming, Write a program that prompts for the user's first and last names. Declare a third array that will hold the user's last name and first name, separated by a comma and space. Use loops to inter through the names one character at a time, storing them into the full name array. Don't forget about the terminating character. Sample run: Enter your first name: john Enter your last name: matthews First name: John Last name: Matthews Full name:...
C# code Arrays and Linked Lists: Write C++/Java/C#/Python code to declare an array of linked lists of any primitive type you want. (Array of size 2020) (This could be based on MSDN libraries or the lab) – you do not need to instantiate any of the linked lists to contain any actual values. Paste your code for that here (this should only be one line) Based on your code or the lab from 4 or your doubly linked list from...
Hand-write code to declare a two dimensional array of 3 columns and 4 rows. The Array will hold doubles. What is the array initialized to by default?
*C CODE* 1. Declare an array of doubles of size 75 called scoreBonus and initialize all the elements in the array to 10.5 2. Declare an array of integers called studentNumbers The array can hold 112 integers Prompt and get a number from the user for the third element in the array Prompt and get a number from the user for the last element in the array
Write you code in a class named HighScores, in file named HighScores.java. Write a program that records high-score data for a fictitious game. The program will ask the user to enter five names, and five scores. It will store the data in memory, and print it back out sorted by score. The output from your program should look approximately like this: Enter the name for score #1: Suzy Enter the score for score #1: 600 Enter the name for score...
P3 - An Array of objects (120 points) Write a main program and declare an array of 5 RectangularCube objects [20pts). a. Use a loop to initialize an array of RectangularCube. In the body of the loop use the rand () function to generate random integers between 1 and 10 to assign to length, width and height data fields of each RectangularCube object (40pts) b. Write the function with header void printCube (RectangularCube rs) that receives an object of the...
Consider the following database and answer the questions below. a) Write the SQL statement the displays the names of the students who have enrolled in the Database Systems course b) Write the SQL statement that displays a list of the students whose names start with 'S' c) Write the SQL statement that displays the Student ID, Student Name, Course ID, and Grade for students that passed at least one course with a grade better than B+ (i.e. A-, A, and...
C++ Programming 1. Write a function (header and body) that accepts an integer as an argument and returns that number squared. 2. Write the code that will fill an integer array named multiples with 10 integers from 5 to 50 that are multiples of five. (This should NOT be in the form of an initialization statement.) 3. Write the code that will display the contents of the integer array named multiples. Recall: the size of the array is 10. 4....
Write a C++ program that produces the following output: /* OUTPUT Enter your age: 21 Enter the last name: Lee Hello Tom Lee. You are 21 years old. Press any key */ Declare an array named: firstName The array is a c_string, i.e., it is a null-terminated character array. The size of the array is 10. Assign a first name to it when it is declared. Declare an array named: lastName The array is a c_string, The size of the...
CAN SOMEONE PLEASE HELP ME WRITE THIS CODE IN C++, PLEASE HAVE
COMMENTS IN THE CODE IF POSSIBLE!!
General Description: Write a program that allows the user to enter data on their friends list. The list holds a maximum of 10 friends, but may have fewer. Each friend has a name, phone number, and email address. The program first asks the user to enter the number of friends (1-10). You are not required to validate the entry, but you may...