Programming in C
4th Edition
ISBN: 9780321776419
Author: Stephen G. Kochan
Publisher: Addison-Wesley
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 10, Problem 11E
Given the definition of a d structure as defined in this chapter, write a function called d that takes a pointer to a d structure as its argument and that updates the structure to the following day (see
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Create a program in C as follows:- Declare four floats as a1, a2, a3 and a4- Create a menu as follows:Option T to ask the user for and assign values to each of a1, a2, a3, and a4.Option V to call a function named cat that has four pointers of type float as parametersand no return. The function will sort, in ascending order, the values in a1, a2, a3 and a4.Option B to call a function named mouse that has four pointers of type float asparameters and no return. The function will sort, in descending order, the values in a1,a2, a3 and a4.Option K to call a function named dog that has four floats as parameters and no return.This function will print to the screen each of the values in a1, a2, a3 and a4 in aformatted manner (right justified with a field width of 12).Ex:a1 = 23.65a2 = 99.22a3 = 1.56a4 = 0.50Option X to exit the program.
In C++, If you had the double-pointer above and also had these variables:
type x, * q;
And had executed these statements:
q = &x; p = &q;
How would a function given p by value be able to change the contents of x?
Consider the following structure definition and solve the following problems. 1. Write a C program that will read all the information from a file named “mobileInfo.txt” and initialize the SmartPhone type array. 2. Write a function that will find all the devices from a specific country and print the information using the function printMobileInfo. call the printMobileInfo from countryWisePhone function. Use the prototypes below -void countryWisePhone( SmartPhone mobileList[], int size, char *country); void printMobileInfo(SmartPhone mobile); 3. Write a function that will print all the information in the main of a specific smart phone and delete all the information from the file and update that file. Use the function prototype – void deletePhone( SmartPhone mobileList[], int size, SmartPhone *highestPricePhone, int phoneID);
Chapter 10 Solutions
Programming in C
Ch. 10 - Type in and run the 15 programs presented in this...Ch. 10 - Write a function called to insert a new entry into...Ch. 10 - Prob. 3ECh. 10 - Write a function called r to remove an e from a...Ch. 10 - Prob. 5ECh. 10 - Prob. 6ECh. 10 - Prob. 7ECh. 10 - Prob. 8ECh. 10 - Prob. 9ECh. 10 - Prob. 10E
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Is the following comment written using single-line or multi-line comment symbols? / This program was written by...
Starting Out with C++ from Control Structures to Objects (9th Edition)
3.12 (Date Create a class called Date that includes three pieces Of information as data
members—a month (type ...
C++ How to Program (10th Edition)
For the function specified in Table 4—16, determine the minimum POS expression using a Karnaugh map.
Digital Fundamentals (11th Edition)
Practice Problem 2.9 solution page 146 Computers generate color pictures on a video screen or liquid crystal di...
Computer Systems: A Programmer's Perspective (3rd Edition)
Land Calculation One acre of land is equivalent to 43,560 square feet. Write a program that calculates the numb...
Starting Out with C++ from Control Structures to Objects (8th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Write a program that performs the following procedures: 01. Structure stores marks of 7 courses with total marks and grades. 02. Get data from the user and store it inside the structure by returning from a user-defined function. 03. Calulate's the grade by passing the pointer of the total marks variable to the user-defined Grade Calculator function. 04. Calculates the grade and store it inside the structure's grade attribute. 05. Prints that structure data of marks and grades. do it in c++ languagearrow_forwardPlease answer in C++ Define a structure called Date with month, day and year as its only data members, Time with hour and minute as its only members and Event with desc (a c-string for description of maximum size 80), date (of type Date) and time (of type Time). Write a readEvents() function that will keep asking the user if he or she wants to add a new event. As long as the user answers with a 'y' or 'Y', allocate memory dynamically for an Event structure, storing the pointer returned by new in the array of Event pointers and then read the Event data from the keyboard and store them in the Event just created. Dates should be entered like 5/21/20 and times as 10:15. When finished entering the Events, the function will return the number of Events entered. Write a sort-desc() function to sort the Events by their description by rearranging the pointers (rather than the structures), by passing it the array of pointers and the number of Events created. Use a swapPtrs() function to swap…arrow_forwardWrite a C++ Program to create a pointer that points to a structure. It is similar to how pointers pointing to native data types like int, float, double, etc. are created. A pointer in C++ will store a memory location. Following steps should be followed to perform a task. • Start of the body of the struct name Length. • Create a struct member named meters of integer data type and centimeters of float data type. • End of the body of the struct Length. • Call the main () function. • Create a pointer variable *ptr and normal variable l of type Length. Store the address of variable l in our pointer variable. • Take user input of meter and centimeter through *ptr. • Print the length in meters and in centimeters through using *ptr.arrow_forward
- 5 . A function may contain more than one return statements. True False 6 . _____ Keyword introduces a structure declaration. True False 7 . Same names can be used for different functions without any conflict. True False 8 . The variables commonly used in C functions are availableto all the functions in a program. True False 9 . Members of different structures must have unique names. True False 10 . How can we return control from a called function to the caller function a. struct b. return c. printfarrow_forward11 . A variable that’s known only within the function in which it’s defined is called a(n). a. Local Variable b. Global Variable 12 . The _______ of an identifier is the portion of the program in which the identifier can be used. a. Function Definition b. Function Declaration c. Function Call d. Function Return 13 . What is the only function all C++ programs must contain? a. start() b. system() c. main() d. program() 14 . A pointer variable contains as its value of another variable. True Falsearrow_forwardThe Task: Create a pointer to a function that takes an integer argument and returns an array of pointers to functions that accept a string argument and return an integer.Whew! You have to read the specification at least three times to realise you don't comprehend it.How do you handle such complication?arrow_forward
- Mcq’s 1. A function is invoked with a a. Function Definition b. Function Declaration c . Function Call d. Function Return 2. What is the only function all C++ programs must contain? a. start() b. system() c. main() d. program() 3. A function that calls itself either directly or indirectly is a(n) function. a. Infinite Function b. Recursive Function c. Prototype Function 4. Structures may not be compared by using operators == and !=. True False 5. Structures are always passed to functions by call by reference method. True False 6. Same names can be used for different functions without any conflict. True False 7. A recursive function typically has two components: one that provides a means for the recursion to terminate by testing for a case, and one that expresses the problem as a recursive call for a slightly simpler problem than the original…arrow_forwardWrite a C++ program to make a structure of a student consisting of integer age, char name and structure roll number that further divides into department, session, registration number and degree. Set and display all the values from main function and display the record on screen to present the access of structure within structure. You have to by access structure using pointer type variable of structure.arrow_forwardIn this part your will have questions about C++ functions with pointers. • Write a function that takes three integer pointer as parameters and calculates sum of all numbers. This function must return the result as a pointer. • Declare a structure about a book which has properties such as name and price etc. Then create a list of book with 5 books. After that define a function that takes this book-list as a pointer and print out list items. • Write a function that calculates total price of the book in the book list (note: take the book-list as a pointer again). Write all function prototypes and test all functions within a single main functions.arrow_forward
- Write a C++ program to make a structure of a student consisting of integer age, char name and structure roll number that further divides into department, session, registration number and degree. Set and display all the values from main function and display the record on screen to present the access of structure within structure. You have to by access structure using pointer type variable of structure.#include<iostream> using namespace std; struct student{ char name[15]; struct roll_no{ char dep[5]; }rn; }; int main() { student s1; cout<<"enter name: "<<endl; cin>>s1.name; cout<<"enter dep: "<<endl; cin>>s1.rn.dep; cout<<"name is: "<<s1.name<<endl; cout<<"roll no is: "<<endl; cout<<"department: "<<s1.rn.dep<<endl; } Hint: (s1+i)->name, (s1+i)->rn.deparrow_forwarda c++ program for a (cafe system) that includes this specifications: -Functions (should include both: pass by value and pass by reference variables, void function and unction returning any value) - Array of structs (at least one single array of struct) - Selection and repetition structures as needed - Add your team members names as a comment in the first line of your program - You should print a menu to the user and offer him/her different services. - Main Services: 1-adding new item. 2-search for specific item. 3-update existing record. 4-delete. 5-Sort. 6-Display. 7-At the start, your program should populate the array(s) from a file and allow the user to edit it. At the end overwrite the same file with the latest contents of the array(s). 8-Provide another statistical report as separate text file e.g. the number of records, with date, time of last update. - The program should continue running until the user chooses to exit it. - Ensure to avoid any errors of any type (Run-time error,…arrow_forwardTrue or False. In a statically-scoped functional language, a function must be represented at run time as a pair of pointers, a pointer to the environment in which the function was defined.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
What Are Data Types?; Author: Jabrils;https://www.youtube.com/watch?v=A37-3lflh8I;License: Standard YouTube License, CC-BY
Data Types; Author: CS50;https://www.youtube.com/watch?v=Fc9htmvVZ9U;License: Standard Youtube License