C++ How to Program (10th Edition)
10th Edition
ISBN: 9780134448237
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 8, Problem 8.14E
(What Does This Code Do?) What does this
1. // EX. 8.14: ex08 14.cpp
2. // What does this program do?
3. #include <iostream>
4. using namespace std;
5.
6. int mystery2(const char*);//prototype
7.
8. int main () {
9. char string1[80];
10.
11. cout <<”Enter a string:";
12. cin >string1;
13. cout << mystery2(string1)<< endl;
14. }
15.
16. // What does this function do?
17. int mystery2 (const char* s) {
18. unsigned int x;
19.
20. for (x = 0; *s != ‘\0’; ++s) {
21. ++x ;
22. }
23.
24. return x;
25. }
Fig. 8.20| What does this program do?
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
19- Correct the following code. Keep the first line of code (double getValue () ()
double getValue() {
double x = 5.1;
return x;
}
int main()
(
3
C++
cout<
DO NOT COPY FROM OTHER WEBSITES
Correct and detailed answer will be Upvoted else downvoted. Thank you!
Q3: (Tax Calculator) Develop a Java program that determines the total tax for each of four citizens. The tax rate is 10% for earnings up to 50,000 RM earned by each citizen and 15% for all earnings in excess of that ceiling. You are given a list with the citizens’ names and their earnings in a given year. Your program should input this information for each citizen, then determine and display the citizen’s total tax. Use class Scanner to input the data.
Chapter 8 Solutions
C++ How to Program (10th Edition)
Ch. 8 - (True or False) State whether the following are...Ch. 8 - (Write C++ Statements) For each of the following,...Ch. 8 - (Write C++ Statements) for each of the following,...Ch. 8 - (Function Headers and Prototypes) Perform the task...Ch. 8 - (Find the Code Errors) Find the error in each of...Ch. 8 - (Simulation: The Tortoise and the Hare) In this...Ch. 8 - (What Does This Code Do?) What does this program...Ch. 8 - (What Does This Code Do?) What does this program...Ch. 8 - In the next several problems, we take a temporary...Ch. 8 - (Computer Simulator) It may at first seem...
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
- int mystery (int u, int v) { int a; a = u - V; u = a; V = u; return u + v; choose the output of the follos cout << mystery (9,7); Select one: a. 7 b. 4 C. 9arrow_forward## Q3. Finding the largest number from three numbers. **C++ #include using namespace std; int findLargest3(int a, int b, int c) { int largest; // Put your code here return largest; int main() { int a, b, c; cout > a; cin >> b; cin >> c; cout << "The largest number is " <« fingLargest3(a, b, c) « endl; return 1; *Hint 1: Considering the case that the two or three numbers are equal.*arrow_forwardX15: inOrder Write a function in Java that implements the following logic: Given three ints, a, b , and c,return true if b is greater than a, and c is greater than b.However, with the exception that if bok is true, b does not need to be greater than a.arrow_forward
- 1. Write a java program to display the A) Arithmetic exception. B) Array bounds exception. C) String bounds exception. Using try and catch. 2. Write a Java program to find the evaluation of quadratic equation using methods. (Provided – a=2,b=6 and c=8) . 3.Using Java Biuild Rectangle class will also have the following methods: Specification: setLength- The setLength method will store a value in an object’s length field. setWidth- The setWidth method will store a value in an object’s width field. getLength- The getLength method will return the value in an object’s length field. getWidth- The getWidth method will return the value in an object’s width field. getArea- The getArea method will return the area of the rectangle, which is the result of the object’s length multiplied by its width.arrow_forward#include <stdio.h> #include <stdlib.h> #include<string.h> #pragma warning(disable:4996) int main(void) { // Variable declarations int t = 0; float k,y,u,i; int a,b,c,d; int p; float add,tt; char name[30],ic[20]; char addr[50]; //The personal details of customer // printf("\n=================================================================================\n"); printf("\n Vegetable ordering system\n"); printf("\n=================================================================================\n"); printf("Please enter your full name :"); scanf(" %[^\n]", &name); printf("Please enter your ic number :"); scanf("%s", &ic); printf("Please enter your phone number :"); scanf("%d", &p); printf("Please enter your home address :"); scanf(" %[^\n]", &addr); printf("\n==================================================================================\n"); printf("The customer name is %s and the ic number is %s \n", name, ic); printf("The customer who is come from…arrow_forwardc++ onlyarrow_forward
- *1. This program takes in user input and calculates each persons share of the cost from a trip.*2. This program uses Scanner for input/*3. This code calculates the final cost less a discount discount..*4. This code displays and formats the result.*/import java.util.*;public class NdunaJoyDiscuss4Wk4 { public static void main(String[] args) { String name = "Joy Nduna"; //My given name String date = "April 08, 2023";//Date code is implemented int course = 141; // The course number int section = 7382; // The section number int numDiscuss = 4; // Assignment week number // Displaying my name, course/section number, discussion week number, date System.out.println("Name: "+name+("\n")+"Class CMIS: "+course+"\n"+"Section : "+section+("\n")+"Assignment 1: Week: "+numDiscuss+("\n")+"Date: "+date); // Create a scanner object to read user inputScanner stdin = new Scanner(System.in);// Prompt for two integers separated by a spaceint…arrow_forwardT/F 3) The parameter (String[ ] variable) is used in a Java key method such that a user may run the software and supply "command-line" parameters. The operator, on the other hand, does not need to have any parameters since the parameter is a String sequence.arrow_forward(In Java language) Create a class Called NetflixDemo Create two objects “user1” and “user2” of the Netflix class pictured below) Set various class variables for the Netflix class using these two objects. Call various methods of Netflix class using these two objects. public class Netflix {public String movies [] = new String[10];public String trendingTop5 [] = new String[5];public String continueWatching [] = new String[5];public String username;public String password;private boolean isAuthenticated;public double balance;public int subscriberSinceYear;public static void logininfo() {Scanner input = new Scanner(System.in);System.out.println("Enter the username");String username = input.nextLine();System.out.println("Enter the password");String password = input.nextLine();boolean isAuthenticated = true;System.out.println(isAuthenticated + " , You have successfully logged in ");System.out.println();}public static void trendingList(){Scanner input = new…arrow_forward
- #include using namespace std; int main() int x=1,y=2; for (int i=0; i<3; i++) e{ x=x*y; 8{ } cout<arrow_forwardC++ Exercisearrow_forward18-If the following lines of code have errors, state them; otherwise, write "no errors" class Book virtual const string state() - 07 void print () ( cout<<"gold"; }; int main() ( } } 19- Correct the following code. Keep the first line of code (double getValue() () double getValue() { double x 5.17 return x; 3 Book b: b.print() int main() ( cout<arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_iosRecommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSONC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Algebraic Expressions – Algebra Basics; Author: TabletClass Math;https://www.youtube.com/watch?v=U-7nq7OG18s;License: Standard YouTube License, CC-BY
Python Tutorial for Beginners 3 - Basic Math, Mathematical Operators and Python Expressions; Author: ProgrammingKnowledge;https://www.youtube.com/watch?v=Os4gZUI1ZlM;License: Standard Youtube License