Starting Out with C++: Early Objects (9th Edition)
9th Edition
ISBN: 9780134400242
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 12.2, Problem 12.3CP
Program Plan Intro
“strcat” function:
The “strcat” function accepts two strings and concatenates or appends those two strings.
Example:
Consider the example of the “strcat” function is as follows:
char a [] = "Hai";
char b [] = "Bye";
strcat(a,b);
Here, the variable “a” stores the string value “Hai” and “b” variable stores the string value “Bye”. The “strcat” function appends the “a” and “b” value together and the variable “a” stores “HaiBye”.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Grade Book
A teacher would like to assign a letter grade to a student, based on student's test score. Write
a program to help this teacher managing her students' test score. Use the following grading
scale to assign a letter grade to a student.
Test Score
Letter Grade
80 - 100
A
70 - 79
B
60 69
C
50 - 59
0- 49
F
Your program must have an array of string objects to hold the student names and an array
of int to hold the student scores. Let the teacher determines the number of students and ask
the teacher to enter the information for each student.
Your program should have the following programmer-defined functions:
getInput () - to read the students name and scores from user
getGrade () - to determine the letter grade corresponding to the score
getReport () - to determine the maximum, minimum, average and standard
deviation of the scores
Display an error message if the teacher enter mark below 0 or above 100, and keep asking
for a valid value.
The program should also be capable of…
NB: You will use only structure variable to solve this problem. You are discouraged to use array of structure.
c code
Screenshot and output is must
Chapter 12 Solutions
Starting Out with C++: Early Objects (9th Edition)
Ch. 12.2 - Write a short description of each of the following...Ch. 12.2 - What will the following program segment display?...Ch. 12.2 - Prob. 12.3CPCh. 12.2 - Prob. 12.4CPCh. 12.2 - Write code that uses the cin.get1ine function read...Ch. 12.2 - Indicate whether the following strcmp function...Ch. 12.2 - Prob. 12.7CPCh. 12.3 - Write a short description of each of the following...Ch. 12.3 - Write a statement that will convert the C-string...Ch. 12.3 - Prob. 12.10CP
Ch. 12.3 - Prob. 12.11CPCh. 12.3 - Prob. 12.12CPCh. 12.4 - What is the output of the following program?...Ch. 12 - A(n)___________is represented in memory as an...Ch. 12 - The____________ statement is required before the...Ch. 12 - A(n)____________is written in your program as a...Ch. 12 - Prob. 4RQECh. 12 - The______________ is used to mark the end of a...Ch. 12 - Prob. 6RQECh. 12 - Prob. 7RQECh. 12 - Prob. 8RQECh. 12 - Prob. 9RQECh. 12 - Prob. 10RQECh. 12 - Prob. 11RQECh. 12 - Prob. 12RQECh. 12 - Prob. 13RQECh. 12 - Prob. 14RQECh. 12 - Prob. 15RQECh. 12 - Prob. 16RQECh. 12 - Prob. 17RQECh. 12 - Prob. 18RQECh. 12 - Write a function whose prototype is char...Ch. 12 - #inc1ude iostream using namespace std; int main()...Ch. 12 - #include iostream using namespace std; int main()...Ch. 12 - #include iostream using namespace std; int main()...Ch. 12 - #inc1ude iostream #inc1ude string using namespace...Ch. 12 - #inc1ude iostream #inc1ude cstring using namespace...Ch. 12 - #inc1ude iostream using namespace std; int main()...Ch. 12 - #inc1ude iostream #inc1ude string using namespace...Ch. 12 - #include iostream #inc1ude cstring using namespace...Ch. 12 - #include iostre4m #inc1ude cstring using namespace...Ch. 12 - Each of the following programs or program segments...Ch. 12 - Soft Skills 30. You are a member of a...Ch. 12 - Prob. 1PCCh. 12 - Prob. 2PCCh. 12 - Prob. 3PCCh. 12 - Prob. 4PCCh. 12 - Name Arranger Write a program that asks for the...Ch. 12 - Prob. 6PCCh. 12 - Prob. 7PCCh. 12 - Prob. 8PCCh. 12 - Prob. 9PCCh. 12 - Password Verifier Imagine you are developing a...Ch. 12 - Prob. 11PCCh. 12 - Check Writer Write a program that displays a...Ch. 12 - Prob. 13PCCh. 12 - Dollar Amount Formatter Modify Program 12-13 by...Ch. 12 - Word Separator Write a program that accepts as...Ch. 12 - Prob. 16PCCh. 12 - I before e except after c A friend of yours who is...Ch. 12 - User Name Write a program that queries its...Ch. 12 - String Splitter Write a function vectorstring...Ch. 12 - Palindromic Numbers A palindromic number 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
- in c language typedef _people { int age; char name[ 32 ] ; } People_T ; People_T data [ 3 ]; Using string lib function, Assign 30 and Cathy to the first cell, Assign 40 and John to the second cell and Assign 50 and Tom to the third cellarrow_forward#include <iostream>using namespace std;struct item{ int id; float price;} s[50];int size = 0;void addData() { cout << "Enter an item data " << endl; cout << "Enter id: "; cin >> s[size].id; cout << "Enter price: "; cin >> s[size].price; cout << "successfully added" << endl << endl; size++; for (int i = 0; i < size; i++) { for (int j = i + 1; j < size; j++) { if (s[i].price > s[j].price) { struct item t = s[i]; s[i] = s[j]; s[j] = t; } } }}void retrivePrice() { int id; cout << "enter the element id:"; cin >> id; cout << endl; int i; for (i = 0; i < size; ++i) { if (id == s[i].id) { cout << "price for this item: " << s[i].price << endl << endl; break; } } if (i == size) cout…arrow_forward#include <iostream>using namespace std;struct item{ int id; float price;} s[50];int size=0; void addData(){ cout << "Enter an item data " << endl; cout << "Enter id: "; cin >> s[size].id; cout << "Enter price: "; cin >> s[size].price; cout<<"successfully added"<<endl<<endl; size++; for(int i=0;i<size;i++) { for(int j=i+1;j<size;j++) { if(s[i].price>s[j].price) { struct item t=s[i]; s[i]=s[j]; s[j]=t; } } }}void retrivePrice(){ int id; cout<<"enter the element id:"; cin>>id; cout<<endl; int i; for( i = 0; i < size; ++i) { if(id == s[i].id){ cout << "price for this item: " << s[i].price << endl<<endl;…arrow_forward
- products := [5] string {"bread", "milk", "eggs", "butter", "sugar"} price := [5] float64{1.29, 3.75, 3.33, 2.97, 5.28} use a "counting loop" to print the products with their prices example: bread: $1.29 milk: $3.75 eggs: $3.33 butter: $2.97 sugar: $5.28arrow_forwardOption #1: String Values in Reverse Order Assignment Instructions Write a Python function that will accept as input three string values from a user. The method will return to the user a concatenation of the string values in reverse order. The function is to be called from the main method. In the main method, prompt the user for the three strings.arrow_forwardFlowchart, create. #include <iostream> #include <string> using namespace std; double computeRate(int); double computeRate(int, string); int main() { int days; string mealPlan; string question; double rate = 0.0; cout << "How many days do you plan to stay? " << endl; cin >> days; cout << "Do you want a meal plan? Y or N: " << endl; cin >> question;if(question=="Y" || question == "y") {cout<<"Enter the meals code: "<<endl;cin >> mealPlan;rate = computeRate(days,mealPlan );} else {rate = computeRate(days);} // Figure out which arguments to pass to the computeRate() function and // then call the computeRate() function cout << "The rate for your stay is $" << rate << endl; return 0; } // End of main() function // Write computeRate functions here.double computeRate(int days) {return days * 99.99;}double computeRate(int days, string s) {if(s == "A") {return days * 169;} else {return days * 112;}}arrow_forward
- Assume that int a[ 2 ][ 2 ] = { { 1, 2 }, { 3, 4 } }; the value of a[ 1, 1 ] = ______;arrow_forwardshortest.py • Create a program, shortest.py, that has a function that takes in a string argument and prints a sentence indicating the shortest word in that string. If there is more than one word print only the first. Your print statement should read: "The shortest word is x" Where x = the shortest word. The word should be all uppercase.arrow_forward#include <iostream>#include <string>#include <iomanip>using namespace std;// structurestruct Hat{string size;string color;float price;};// declare the structure variable int main(){Hat hat_1,hat_2,hat_3,hat_4,hat_5; cout<<"Welcome to Hats For U!\n";cout<<"Hat 1\n";cout<<"Enter the hat size: ";cin>>hat_1.size;cout<<"Enter the hat color: ";cin>>hat_1.color;cout<<"Enter hat price: ";cin>>hat_1.price; cout<<"Hat 2\n";cout<<"Enter the hat size: ";cin>>hat_2.size;cout<<"Enter the hat color: ";cin>>hat_2.color;cout<<"Enter hat price: ";cin>>hat_2.price; cout<<"Hat 3\n";cout<<"Enter the hat size: ";cin>>hat_3.size;cout<<"Enter the hat color: ";cin>>hat_3.color;cout<<"Enter hat price: ";cin>>hat_3.price; cout<<"Hat 4\n";cout<<"Enter the hat size: ";cin>>hat_4.size;cout<<"Enter the hat color:…arrow_forward
- #include <iostream>#include <string>#include <iomanip>using namespace std;// structurestruct Hat{string size;string color;float price;};// declare the structure variable int main(){Hat hat_1,hat_2,hat_3,hat_4,hat_5; cout<<"Welcome to Hats For U!\n";cout<<"Hat 1\n";cout<<"Enter the hat size: ";cin>>hat_1.size;cout<<"Enter the hat color: ";cin>>hat_1.color;cout<<"Enter hat price: ";cin>>hat_1.price; cout<<"Hat 2\n";cout<<"Enter the hat size: ";cin>>hat_2.size;cout<<"Enter the hat color: ";cin>>hat_2.color;cout<<"Enter hat price: ";cin>>hat_2.price; cout<<"Hat 3\n";cout<<"Enter the hat size: ";cin>>hat_3.size;cout<<"Enter the hat color: ";cin>>hat_3.color;cout<<"Enter hat price: ";cin>>hat_3.price; cout<<"Hat 4\n";cout<<"Enter the hat size: ";cin>>hat_4.size;cout<<"Enter the hat color:…arrow_forwardComplete the code: string cars[5] = {"Volvo", "BMW", "Ford", "Mazda", "Honda"}; for(int i = 0; i < - ; i++) { cout << cars[i]< "\n"; } %3Darrow_forward#include <iostream>#include <vector>#include <algorithm> using namespace std; struct Player { string firstName; string lastName; int jerseyNumber; int rating;}; // Prompt menu options to uservoid displayMenu() { cout << "MENU\n"; cout << "a - Add player\n"; cout << "d - Remove player\n"; cout << "u - Update player rating\n"; cout << "o - Output roster\n"; cout << "q - Quit\n"; cout << "\nChoose an option: \n"; } // Add new player to the rostervoid addPlayer(vector<Player>& roster) { Player newPlayer; cout << "\nEnter the new player's data\n"; cout << "first name:\n"; cin >> newPlayer.firstName; cout << "last name:\n"; cin >> newPlayer.lastName; cout << "jersey number:\n"; cin >> newPlayer.jerseyNumber; cout << "rating:\n\n"; cin >> newPlayer.rating; roster.push_back(newPlayer);} // Remove a…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT