Concept explainers
(What Does This Code Do?) What does this
1. // Ex. 8.13: ex08_13.cpp
2. // what does this program do?
3. #include <iostream>
4. using namespace std;
5.
6. void mystery1 (char*, const char*); // prototype
7.
Fig. 8.19 What does this program do? (Part 1 of 2.)
8. int main () {
9. char string1 [80];
10. char string2 [80];
11.
12. cout<< ”Enter two strings:” ;
13. cin >> string1 >> string2 ;
14. mystery1 (string1, string2);
15. cout<<string1<<endl;
16. }
17.
18. //what does this function do?
19. void mystery1(char* s1, const char* s2) {
20. while (*s1 != ‘\0’) {
21. ++s1;
22. }
23.
24. for (;(*s1 = *s2); ++s1; ++s2) {
25. ; // empty statement
26. }
27. }
Fig 8.19 What does this program do? (Part 2 of 2)
Want to see the full answer?
Check out a sample textbook solutionChapter 8 Solutions
C++ How to Program (10th Edition)
- HCI is (Human Computer Interaction) Answer the following five statements by first stating whether it is true or false and then given one sentence for justifying your answer a) You drag a folder to make a copy of its contents. An animation appears on the screen, showing files moving from one folder to another. This is an example of feedback. b) In augmented reality a screen is composed of a computer animation of the reality. c) The Model Human Processor is used in HCI to model complex cognitive processes d) Petri Nets can be helpful in modeling concurrent activities in a user interface. e) Gestalt is important to HCI as it offers tools to understand scenes.arrow_forwardComplete the function ConvertToWeeksAndDays to convert totalDays to weeks and days. Return weeks and days using the TimeWeekDay struct. Ex: 26 days is 3 weeks and 5 days. Only lines 11-13 can be added onto, the rest of the program can't be changed.arrow_forwardCan you explain why this program doesn’t run without credits=int(input())) What does this one line of code do to make everything else flow together?arrow_forward
- Zybooks C++ 1.7 LAB: Introduction to data structures labs Step 1: Producing correct output Three commented-out lines of code exist in main(). Uncomment the lines and click the "Run program" button. Verify that the program's output is: 2 + 2 = 4 Unknown function: PrintPlus2 Secret string: "abc" Submit your code for grading. Your submission will pass the "Compare output" test only, achieving 1 of the possible 10 points. Step 2: Inspecting the LabPrinter class Inspect the LabPrinter class implemented in the LabPrinter.h file. Access LabPrinter.h by clicking on the orange arrow next to main.cpp at the top of the coding window. Member functions Print2Plus2() and PrintSecret() print strings using std::cout. Step 3: Implementing CallFunctionNamed() Remove the three uncommented lines from main(). Then implement the CallFunctionNamed() function in main.cpp to handle three cases: If functionName is "Print2Plus2", call printer's Print2Plus2() member function. If functionName is "PrintSecret",…arrow_forward(Q6) This is a Data Structures problem and the programming language used is Lisp. Solve the question we detailed steps and make it concise and easy to understand. Please and thank you. Can you please explain this question specifically what you are doing in each step because it is a very confusing topic. Thanks!arrow_forward19.arrow_forward
- state the statement either true or false.arrow_forwardQ1) Please someone help me based the program given ,how can I add one feature of "Total sale amount "in the daily report" #include <stdio.h>#include <stdlib.h>#pragma warning(disable : 4996) int main(void){ char category[] = { 'A', 'B', 'C', 'D' };float price[] = { 24.50, 26.00, 27.50, 29.00 };int quantity[] = { 0, 0, 0, 0 };int count = 1;int qtyA = 0, qtyB = 0, qtyC = 0, qtyD = 0;float total = 0.0, discount = 0.0, delivery = 0.0, net = 0.0;char ch = 'A', choice = 'Y';int p = 0;char name[50], ic[20], addr[100]; printf("\n\n<MENU PRICES OF VEGETABLE>");printf("\n===============================================================================");printf("\n Packages Price ");printf("\n===============================================================================");printf("\n A (kangkung,cabbage,Ladies finger,banana) RM 24.50 ");printf("\n B (Yam leaves,long bean,brinjal,guava) RM 26.00 ");printf("\n C (snake beans,broccoli,spinach,papaya) RM 27.50 ");printf("\n D (bak…arrow_forward31. Need C, C++, Java, Python, or Perl code for the below question. Important: Do not copy codes from prepinsta.com.arrow_forward
- C++++arrow_forward12. Common "The commonality between science and art is in trying to see profoundly - to develop strategies of seeing and showing." -Edward Tufte Write a Java program to find common elements between two given string arrays. Program Description Complete the main function that, given two arrays, arr1, arr2, with their sizes prints an array containing the common elements in these arrays. DO NOT USE ANY JAVA BUILT- IN ARRAY FUNCTIONS TO FIND COMMON ELEMENTS. Constraints • None Input Format For Custom Testing Sample Case 0 Sample Input For Custom Testing 5 1 1 1 1 1 3 1 2 3 Sample Output ['1'] Explanation String value '1' is the only common element between the given two arrays. Sample Case 1arrow_forward1. [LO 1, LO 2, LO 3 & LO 4, Treasure Hunter Description You are in front of a cave that has treasures. The cave can be represented in a grid which has rows numbered from 1 to , and columns numbered from 1 to . For this problem, define (x,y ) as a tile that is in the the-x row and the y-row. There is a character in each tile, which indicates the type of that tile. Tiles can be floors, walls, or treasures which are represented respectively by the characters '.' (period), '#' (hashmark), and '*' (asterisk). You can go through the floor tiles and treasures, but you can't get past the wall tiles.Initially, you are in a tile (??, Sy). You want to visit all the treasure squares, and retrieve the treasure. When you visit a treasure tile, the treasure is instantly retrieved, and the tile turns into a floor.In a move, if you are on a tile (?,y), then you can move to the right tile above (?-1,y), right (?,y + 1), down (? + 1, ), and left (?, 1) of the current tile. The tile you visit must…arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning