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
Concept explainers
Question
Chapter 21, Problem 21.18E
Program Plan Intro
Inserting a String
- Include the required header files.
- Define the “main” function.
- Create string variables str1 with the value “World School” and str2 with “******”.
- Create an integer variable len and assign it to the half of the length of str1.
- Display the value of str1.
- Insert str2 at the middle position of str1.
- Display the new value of str1.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
(Python matplotlib or seaborn)
CPU Usage
We have the hourly average CPU usage for a worker's computer over the course of a week. Each row of data represents a day of the week starting with Monday. Each column of data is an hour in the day starting with 0 being midnight.
Create a chart that shows the CPU usage over the week. You should be able to answer the following questions using the chart:
When does the worker typically take lunch?
Did the worker do work on the weekend?
On which weekday did the worker start working on their computer at the latest hour?
cpu_usage = [
[2, 2, 4, 2, 4, 1, 1, 4, 4, 12, 22, 23,
45, 9, 33, 56, 23, 40, 21, 6, 6, 2, 2, 3], # Monday
[1, 2, 3, 2, 3, 2, 3, 2, 7, 22, 45, 44,
33, 9, 23, 19, 33, 56, 12, 2, 3, 1, 2, 2], # Tuesday
[2, 3, 1, 2, 4, 4, 2, 2, 1, 2, 5, 31,
54, 7, 6, 34, 68, 34, 49, 6, 6, 2, 2, 3], # Wednesday
[1, 2, 3, 2, 4, 1, 2, 4, 1, 17, 24, 18,
41, 3, 44, 42, 12, 36, 41, 2, 2, 4, 2, 4], # Thursday
[4, 1, 2, 2, 3, 2, 5, 1, 2, 12, 33, 27,
43, 8,…
Complete answer
Q2: (Debugging Code) : As you are learning to program in C, you will often spend a lot of time debugging
code and finding errors. It takes a lot of practice to develop this skill. There are many errors in the following
program. Find and correct all the errors so that the program compiles and produces the correct output. (Add
a new comment on line 1 of the code and list the errors.)
Find all the errors challenge
* include
Chapter 21 Solutions
C++ How to Program (10th Edition)
Ch. 21 - Prob. 21.4ECh. 21 - Prob. 21.5ECh. 21 - (Find Code Error) Find any errors in the following...Ch. 21 - (Simple Encryption) Some information on the...Ch. 21 - Prob. 21.8ECh. 21 - Prob. 21.9ECh. 21 - (String Concatenation) Write a program that...Ch. 21 - (Hangman Game) Write a program that plays the game...Ch. 21 - (Printing a string Backward) Write a program that...Ch. 21 - (Alphabetizing Animal Names) Write a program that...
Ch. 21 - Prob. 21.14ECh. 21 - Prob. 21.15ECh. 21 - Prob. 21.16ECh. 21 - Prob. 21.17ECh. 21 - Prob. 21.18ECh. 21 - (Erasing Characters from a string) Write a program...Ch. 21 - Prob. 21.20ECh. 21 - Prob. 21.21ECh. 21 - Prob. 21.22ECh. 21 - Prob. 21.23ECh. 21 - Prob. 21.24ECh. 21 - Prob. 21.25ECh. 21 - (Cooking with Healthier Ingredients) Obesity in...Ch. 21 - Prob. 21.27MADCh. 21 - (SMS Language) Short Message Service (SMS) is a...
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
- 12: guess.cpp) Write a program that plays a guessing game with the user. The user should pick a letter, and the computer should try to guess the letter. After each guess, the user should tell the computer whether its guess was too high or too low. With this information, the computer should be able to guess the letter within five tries. The user should be able to give whole words or single upper or lower case letters as responses.arrow_forwardshort answers : c)Give an example of a common floating point arithmetic error due to the particular way in which floating point numbers are stored? d)Give an example of how when using C-strings and the functionstrcpy, things can go wrong.arrow_forward6: forLoops.cpp) a) Print the even numbers between 3 and 43. b) Print every third letter starting with 'B'. c) Print the numbers 1 to 20 in one column right next to another column with the numbers 20 down to 1. d) Print every other character in the computer's character set. Write this assignment as one program with 4 void functions.arrow_forward
- commas.cpp) Write a program that accepts a 7-9) digit//integer and echoes the number with commas between every//three digits from the right. Test it with the numbers//, 20300045, & 10000000 c++ // program inserts comas into number given #include <iostream>using namespace std;int main(){int leadingDigits,middledigits,lastdigits;int tempValue,original;cout<< "please enter a 7-9 digit number.\n";cin>>original;tempValue=original/1000;lastdigits=original%1000; // add code lastdigits=original%100; // corrected codeleadingDigits=tempValue/1000;middledigits=tempValue%1000; // add code middledigits=tempValue%100; // corrected code cout<<"the number with comas is "<<leadingDigits;cout<< ","<<middledigits/1<< "," <<lastdigits/1<<endl; // correct this to print individual digits of middle and last digitsreturn 0;}arrow_forwardc++arrow_forward6: forLoops.cpp)a) Print the even numbers between 3 and 43.b) Print every third letter starting with 'B'.c) Print the numbers 1 to 20 in one column right next toanother column with the numbers 20 down to 1.d) Print every other character in the computer's characterset.Write this assignment as one program with 4 voidfunctions.arrow_forward
- Q1) (NOTE: Do Not Use Array in This Question). Write a C++ program that asks the user to enter a positive integer value that represents the number of integer numbers remaining to be entered. The user should then enter the integer numbers according to that value. The program should output the smallest and largest numbers, and compute how many even and odd numbers are entered.arrow_forwardPlease explain Python code # 2) write a procedure that takes a string and # returns it with all its vowels deleted# e.g. Wilkes! would return Wlks!# assume vowels are: aeiou sometimes ydef killvowels(word):vwlss = ""for c in word:# if it is not a vowelif c not in ['a','e','i','o','u']:if c != 'y' or (c == 'y' and random.choice([1,2,3,4]) != 1):vwlss += creturn vwlssdef killvowelsinplace(word):for c in range(len(word)):if word[c] in ['a','e','i','o','u']: # let's ignore yword = word[:c] + word[c+1:] return worddef vowelkiller(word,index):if index < len(word):if word[index] in ['a','e','i','o','u']: # let's ignore yword = word[:index] + word[index+1:] index =- 1 # lost a vowel, so reset indexreturn vowelkiller(word,index+1)return worddef rkillvowelsinplace(word):return vowelkiller(word,0)#rspitoutchars("Wilkes!")print(rkillvowelsinplace("Wilkes!"))print(rkillvowelsinplace("awesome"))print(rkillvowelsinplace("great!"))arrow_forwardWrite the following function to check whether a string is a palindrome assuming letters are case-insensitive: bool isPalindrome(const string& s) Write a test program that reads a string and displays whether it is a palindrome.arrow_forward
- Answer in C++arrow_forward(49 + O A * omework_sheet_i.o_computing[1] (1) البدء f. print total Solution: C exercises - conditional statements 1. Write a C code that prompts the user to input three integer values and find the greatest value of the three values. Page 3 Introduction to Computing By: Mr. Iyad Albayouk Example : Enter 3 integer vales separated by space: 10 15 20 The greatest value is: 20 2. Write a program that determines a student's grade. The program will read three scores and determine the grade based on the following rules: -if the average score >=90% and grade=A -if the average score >= 70% and grade=B -if the average score>=50% and grade=C -if the average scoregrade=F 3. Write C code to compute the real roots of the equation: ax+bx+c=0. The program will prompt the user to input the values of a, b, and c. It then computes the real roots of the equation based on the following rules : - if a and b are zero => no solution - if a is zero =>one root (-c/b ) - if b-4ac is negative =>no roots -…arrow_forward(Q1)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.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended 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 Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Literals in Java Programming; Author: Sudhakar Atchala;https://www.youtube.com/watch?v=PuEU4S4B7JQ;License: Standard YouTube License, CC-BY
Type of literals in Python | Python Tutorial -6; Author: Lovejot Bhardwaj;https://www.youtube.com/watch?v=bwer3E9hj8Q;License: Standard Youtube License