Problem Solving With C++ (Looseleaf) - With Access
9th Edition
ISBN: 9780133835267
Author: SAVITCH
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 8.1, Problem 2STE
What C string will be stored in singingString after the following code is run?
char singingString[20] = “DoBeDo”;
strcat(singingString, “ to you”);
Assume that the code is embedded in a complete and correct
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Write a function called remove. The code will remove the nth index character from a non-empty string.
Use the following code to allow an output to the screen to play a word descrambling game in C++
#include <bits/stdc++.h>using namespace std;
// Function that sorts the given string// and transform a sorted string to uppercasestring sortString(string word){ // Transformed to uppercase transform(word.begin(), word.end(), word.begin(), ::toupper);
// Sort the words sort(word.begin(), word.end()); return word;}
// Function that finds the anagram of// given string in the given text filevoid jumbledString(string jumble){ // Initialize strings string checkPerWord = ""; string userEnteredAfterSorting;
// Sort the string userEnteredAfterSorting = sortString(jumble);
// Using filehandling ifstream // to read the file ifstream words("words.txt");
// If file exist if (words) {
// Check each and every word // of words.txt(dictionary) while (getline(words, checkPerWord)) {
string Ch…
I need a function that takes a string and returns initials such as Bob Burnett becoming B.B.
string CreateAcronym(string userPhrase);int main() {while (true){string userPhrase;getline(cin, userPhrase); if (userPhrase == "") {break; }cout << CreateAcronym(userPhrase) << endl;}return 0;}string createAcronym( const string && userPhrase ) {int i;string acronym;bool use_next = true;
for (i=0; i < userPhrase.size(); i++){char character = userPhrase.at(i);int ascii = (int)character;if(ascii > 64 && ascii < 91 && use_next == true){acronym += character;use_next = false;} else if(ascii == 32){use_next=true;}else{use_next = false;}}return acronym;}
Please fix my program using c++.
Chapter 8 Solutions
Problem Solving With C++ (Looseleaf) - With Access
Ch. 8.1 - Prob. 1STECh. 8.1 - What C string will be stored in singingString...Ch. 8.1 - What (if anything) is wrong with the following...Ch. 8.1 - Suppose the function strlen (which returns the...Ch. 8.1 - Prob. 5STECh. 8.1 - How many characters are in each of the following...Ch. 8.1 - Prob. 7STECh. 8.1 - Given the following declaration and initialization...Ch. 8.1 - Given the declaration of a C-string variable,...Ch. 8.1 - Write code using a library function to copy the...
Ch. 8.1 - What string will be output when this code is run?...Ch. 8.1 - Prob. 12STECh. 8.1 - Consider the following code (and assume it is...Ch. 8.1 - Consider the following code (and assume it is...Ch. 8.2 - Consider the following code (and assume that it is...Ch. 8.2 - Prob. 16STECh. 8.2 - Consider the following code: string s1, s2...Ch. 8.2 - What is the output produced by the following code?...Ch. 8.3 - Is the following program legal? If so, what is the...Ch. 8.3 - What is the difference between the size and the...Ch. 8 - Create a C-string variable that contains a name,...Ch. 8 - Prob. 2PCh. 8 - Write a program that inputs a first and last name,...Ch. 8 - Write a function named firstLast2 that takes as...Ch. 8 - Write a function named swapFrontBack that takes as...Ch. 8 - Prob. 6PCh. 8 - Write a program that inputs two string variables,...Ch. 8 - Solution to Programming Project 8.1 Write a...Ch. 8 - Write a program that will read in a line of text...Ch. 8 - Give the function definition for the function with...Ch. 8 - Write a program that reads a persons name in the...Ch. 8 - Write a program that reads in a line of text and...Ch. 8 - Write a program that reads in a line of text and...Ch. 8 - Write a program that can be used to train the user...Ch. 8 - Write a sorting function that is similar to...Ch. 8 - Redo Programming Project 6 from Chapter 7, but...Ch. 8 - Redo Programming Project 5 from Chapter 7, but...Ch. 8 - Prob. 11PPCh. 8 - Write a program that inputs a time from the...Ch. 8 - Solution to Programming Project 8.14 Given the...Ch. 8 - Write a function that determines if two strings...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
You use these two classes to play an audio file. a. Media and MediaPlayer b. Audio and AudioPlayer c. Sound and...
Starting Out with Java: Early Objects (6th Edition)
Extreme programming expresses user requirements as stories, with each story written on a card. Discuss the adva...
Software Engineering (10th Edition)
For each of the following activities, give a PEAS description of the task environment and characterize it in te...
Artificial Intelligence: A Modern Approach
Write two statements that use a file stream object named pets to open a file named pets.dat. (Show how to open ...
Starting Out with C++ from Control Structures to Objects (9th Edition)
Random Number Guessing Game Write a program that generates a random number and asks the user to guess what the ...
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
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 reads in a line consisting of a students name, Social Security number, user ID, and password. The program outputs the string in which all the digits of the Social Security number and all the characters in the password are replaced by x. (The Social Security number is in the form 000-00-0000, and the user ID and the password do not contain any spaces.) Your program should not use the operator [] to access a string element. Use the appropriate functions described in Table 7-1.arrow_forwardThe code should be in C++, the hints for this are... 1. To search for a word in a line of text, you may use the find() function thatworks with C++ string objects.2. While implementing the search and replace functionality, you may need to makea temporary copy of the text file.arrow_forwardplease code in pythonA string is defined in the code snippet below. Use a single comprehension to make a list of the first letter of each word in the snippet.arrow_forward
- c++ , A character string is given. What is the minimum number of characters you need to change to make the resulting string of identical characters? Solve this task in 3 different manners using : sets, maps and deque ( 3 different codes ) Input output 69pop66 4 1+2=12 4arrow_forwardFinish a C++ code. Assume the <iostream>, <fstream>, and <string> headers have already been included and that main() looks like this: (picture 1) Each row of the capitals.txt file contains the following data, in this order: The city (string, one word) The state (string, one word) The population (integer) (picture 2, of the capitals.txt text) Text to copy for the capitals.txt file: Phoenix Arizona 1660272 Austin Texas 964254 Ohio Columbus 892553 Indianapolis Indiana 867125 Denver Colorado 716492 Boston Massachusetts 694583 Nashville Tennesseee 635710 Sacramento California 466488 Atlanta Georgia 420003 Honolulu Hawaii 359870 Create a function named smallestCapital as follows: The function returns an integer.The function has 5 parameters:Two string arraysOne integer arrayAn ifstream objectAn integer for the length of the arraysThe function should be coded as follows:If the ifstream object did not open the file, return a value of -1.Otherwise, use a while loop to read…arrow_forwardWhat does the following code produce? new String("Cheggers2019"); String myStr = new String("Cheggers2019"); System.out.print(myStr.substring(2, myStr.substring(@,2)); System.out.print(myStr.substring(2, myStr.substring(@,2)); System.out.print a size( a. Error b. Error c. Error d. Error e. c. eg. no outputarrow_forward
- Help with c program using FILE HANDLING (fopen, fputs, fgets, etc.) You can also test the program with the following input.txt file A1, A2 20294 Lorenzana Dr Woodland Hills, CA 91364 B1, B2 19831 Henshaw St Culver City, CA 94023 C1, C2 5142 Dumont Pl Azusa, CA 91112 D1, D2 20636 De Forest St Woodland Hills, CA 91364 A1, A2 20294 Lorenzana Dr Woodland Hills, CA 91364 E1, E2 4851 Poe Ave Woodland Hills, CA 91364 F1, F2 20225 Lorenzana Dr Los Angeles, CA 91111 G1, G2 20253 Lorenzana Dr Los Angeles, CA 90005 H1, H2 5241 Del Moreno Dr Los Angeles, CA 91110 I1, I2 5332 Felice Pl Stevenson Ranch, CA 94135 J1, J2 5135 Quakertown Ave Thousand Oaks, CA 91362 K1, K2 720 Eucalyptus Ave 105 Inglewood, CA 89030 L1, L2 5021 Dumont Pl Woodland Hills, CA 91364 M1, M2 4819 Quedo Pl Westlake Village, CA 91362 I1, I2 5332 Felice Pl Stevenson Ranch, CA 94135 I1, I2 5332 Felice Pl Stevenson Ranch, CA 94135 N1, N2 20044 Wells Dr Beverly Hills, CA 90210 O1, O2 7659 Mckinley Ave Los Angeles, CA 90001…arrow_forwardI need to convert this cod to switch and case statment and put Properly commented for cods . it must run on Devc++ . #include <iostream> using namespace std; int main() {int ch;char size;string item;cout<<"Welcome to Freddy’s Pizza\nPizza Menu:\n1- Vegetarian Pizza\n2- Chicken Dynamite Pizza\n3- Meat Lovers Pizza";cout<<"\nWhich Pizza would you like to try?(Chicken/Meat/Vegetarian) ";cin>>item;cout<<"\nWhat size of pizza would you like (L, M,S)? ";cin>>size;cout<<"\nPizza Order:";cout<<"\nPizza Name:"<<item<<" Pizza";if(item=="Meat"){cout<<"\nPreparation Time: 20 Minutes";cout<<"\nCalories: 250";if(size=='L'){cout<<"\nPizza Price: 8 OMR";}else if(size=='M'){cout<<"\nPizza Price: 6 OMR";}else if(size=='S'){cout<<"\nPizza Price: 4 OMR";}cout<<"\nToppings:";cout<<"\nMinced Meat, Cheese, BBQ Sauce, Fresh Tomatos";}else if(item=="Chicken"){cout<<"\nPreparation Time: 20…arrow_forwardI need psudocode for this - Develop a simple spell checker and word suggestion program using Hashing. A dictionary of words should be given as a first argument (filename) in the program. This input file is the simple text file "Dictionary.txt", where each line is a word (see Files section). The program must ask the user to give a word. (case 1) The program must respond with “True” if the word exists in the dictionary, and must suggest words (from Dictionary) starting with the same first two letters. At the end of each suggestion the exec. time (in micro-sec) must be displayed (see "TimeInterval.h" in Files section). (case 2) If the input word does not exist in Dictionary due to user misspelling, and considering the first letter is correct, the program should return a recommended word from the dictionary (only one word). For example, instead of the word sentence, the user enters snetence, setnence, sentens, orsetence, etc; the program should return: "do you mean sentence?" If "no",…arrow_forward
- #include <iostream>using namespace std; bool isThere(string s, char c, int si, int ei){ //return true if char c is present in s at index in range [si,ei] //return false otherwise //you can assume 0<=si<=ei<s.length() //write your code here }int main(){ //write code here to test the function return 0;}arrow_forwardc++ Need help with part 4 so far i have this: #include <iostream>#include <string>using namespace std; void printMenu() {cout << "\nMENU" << endl;cout << "c - Number of non-whitespace characters" << endl;cout << "w - Number of words" << endl;cout << "f - Find text" << endl;cout << "r - Replace all !'s" << endl;cout << "s - Shorten spaces" << endl;cout << "q - Quit" << endl;}string ExecuteMenu(string text, char choice) {int i, count;string temp;int found;int lenT = text.length(), lenTemp = 0, j;char t;switch (choice) {case 'q':exit(0); break;case 'c':count = 0;for (i = 0; i < text.length(); ++i){if (text[i] != ' ')count++;}cout << "\nNumber of non-whitespace characters : " << count; break;case 'w':count = 1;for (i = 0; i < text.length(); ++i){if (text[i] == ' ')count++;}cout << "\n Number of words : " << count; break;case 'f':cout << "Enter the string to…arrow_forwardWhat will be the output of the following C++ code? #include <iomanip> #include <iostream> using namespace std; int main() { cout << setprecision(17); double d = 0.1; cout << d << endl; return 0; } a) 0.11 b) 0.10000000000000001 c) 0.100001 d) compile time errorarrow_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