EP MINDTAPV2.0 FOR MALIK'S C++ PROGRAMM
8th Edition
ISBN: 9780357425237
Author: Malik
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Chapter 12, Problem 8SA
Explanation of Solution
The program execution is explained in the in-lined comments:
#include <iostream>
using namespace std;
int main()
{
//declares and initializes the string variables
//str1 and str2
string str1 = "sunny";
string str2 = "cloudy";
//declare string type pointer variable s1
string *s1;
//prints the values of str1 and str2 which
//are sunny and cloudy
cout << str1 << " " << str2 << endl;
//assign the address of the memory location of str1
//to s1
s...
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
C++
printSmaller is a function that accepts two int parameters and returns no value. It will print the value of the smaller one parameters. The function protoype is as follows:
void printSmaller(int num1, int num2);
write the statments to read two integers and call this function to display the smaller one.
Create an C++ array of string type using "My dream job is to be a programmer" in sentence form with the application or integration of the following functions or tools:- Character manipulation tools “getline” and “put”- C-String concatenate- Character manipulation tool “isupper”
This assignment is not graded, I just need to understand how to do it. Please help, thank you!
Language: C++
Given:
Main.cpp
#include
#include "Shape.h"
using namespace std;
void main() { /////// Untouchable Block #1 ////////// Shape* shape; /////// End of Untouchable Block #1 //////////
/////// Untouchable Block #2 ////////// if (shape == nullptr) { cout << "What shape is this?! Good bye!"; return; }
cout << "The perimeter of your " << shape->getShapeName() << ": " << shape->getPerimeter() << endl; cout << "The area of your " << shape->getShapeName() << ": " << shape->getArea() << endl; /////// End of Untouchable Block #2 //////////}
Shape.cpp
string Shape::getShapeName() { switch (mShapeType) { case ShapeType::CIRCLE: return "circle"; case ShapeType::SQUARE: return "square"; case ShapeType::RECTANGLE: return "rectangle"; case…
Chapter 12 Solutions
EP MINDTAPV2.0 FOR MALIK'S C++ PROGRAMM
Ch. 12 - Prob. 1TFCh. 12 - Prob. 2SACh. 12 - Prob. 3SACh. 12 - Prob. 4SACh. 12 -
Suppose that you have the declaration int...Ch. 12 -
What is the output of the following C+ + code?...Ch. 12 -
Given the following statements:
write C+ +...Ch. 12 - Prob. 8SACh. 12 - Prob. 9SACh. 12 - Prob. 10SA
Ch. 12 - Prob. 11SACh. 12 - Prob. 12SACh. 12 - Prob. 13SACh. 12 - Prob. 14SACh. 12 - Prob. 15SACh. 12 - What is the output of the following code? (2, 3,...Ch. 12 - Prob. 17SACh. 12 - Prob. 18SACh. 12 - Prob. 1PECh. 12 - Prob. 2PECh. 12 -
Programming Exercise 11 in Chapter 8 explains how...Ch. 12 - Prob. 5PE
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
- C++ PROGRAMMING Create a C++ program that accepts an English sentence and converts it to Pig Latin. The rules of Pig Latin are as follows: If the word starts with a vowel, add the word "yay" in the end. If the word starts with a consonant, move the first letter of the word in the end and add "ay" in the end. If the word starts with a capital letter, follow the rule and convert the first letter of the converted Pig Latin word into a capital letter. (i.e. Hello -> ElloHay) If there are numbers in the sentence, they should not be translated. A word with a combination of letters and numbers will not be tested. Spacing and punctations must be preserved. Sample Input: A quick brown fox jumps over the 100 lazy dogs. Expected Output: Ayay uickqay rownbay oxfay umpsjay overyay hetay 100 azylay ogsday.arrow_forwardCode using c++ 3. From Person to People by CodeChum Admin Now that we have created a Person, it's time to create more Person and this tech universe shall be filled with people! Instructions: In the code editor, you are provided with the definition of a struct Person. This struct needs an integer value for its age and character value for its gender. Furthermore, you are provided with a displayPerson() function which accepts a struct Person as its parameter. In the main() function, there's a pre-created array of 5 Persons. Your task is to ask the user for the values of the age and gender of these Persons. Then, once you've set their ages and genders, call the displayPerson() function and pass them one by one. Input 1. A series of ages and genders of the 5 Persons Output Person·#1 Enter·Person's·age:·24 Enter·Person's·gender:·M Person·#2 Enter·Person's·age:·21 Enter·Person's·gender:·F Person·#3 Enter·Person's·age:·22 Enter·Person's·gender:·F Person·#4…arrow_forwardAssume the Product structure is declared in c++ as follows:struct Product{string description; // Product descriptionint partNum; // Part numberdouble cost; // Product cost}; Now write a loop that will step through the entire array array of 100 Product structures (do not initialize the array), setting all the product descriptions to an empty string, all part numbers to zero, and all costs to zero. ( Drop the screenshot of output as well )arrow_forward
- C++ HELP! Please help, this question was rejected for complexity but I really don't have any one else to ask! I would really like to see what I got wrong so if anyone can solve this please help!Write a complete C++ program with the following: A struct named Car with member variables to store car make, model, and price. A function named setCar that returns a Car and has no parameters. setCar will:prompt the user for a car name, model, and price, and return that car. A void function named showCars with 2 parameters: a constant Car array named cars, and a constant integer named SIZE. The showCars function will:Use a loop to display the make, model, and price of each car in the cars array, and will also display what that car’s position is in the array (for regular computer users who start counting from 1, not programmers who start counting from 0). In the main functionDeclare a constant integer named SIZE with the value of 3.Declare a Car array the size of SIZE. Write a loop to call your…arrow_forwardC++ Code: DNA Sequence The main() function is already written for you. You will implement the function int numOccurrences(string& STR, string& sequence). Without even understanding what functions do in C++, all you need to know, at this point, is that you have access to the string STR of which you have to find the length of the largest consecutive occurrence in the string sequence. For example, if input sequence is: AGACGGGTTACCATGACTATCTATCTATCTATCTATCTATCTATCTATCACGTACGTACGTATCGAGATAGATAGATAGATAGATCCTCGACTTCGATCGCAATGAATGCCAATAGACAAAA then numOccurrences("AGAT", sequence) should return 5 numOccurrences("TATC", sequence) should return 8 if input sequence is: AACCCTGCGCGCGCGCGATCTATCTATCTATCTATCCAGCATTAGCTAGCATCAAGATAGATAGATGAATTTCGAAATGAATGAATGAATGAATGAATGAATG then numOccurrences("AATG", sequence) should return 7 numOccurrences("TATC", sequence) should return 4 if input sequence is:…arrow_forward[c++] struct patient_data{ string name; string no_id_card; int hand_set_number; string address; }; figure 1 By referring to the struct definition in Figure A, you are required to do a STRUCT declaration of MPI clinic patients and write a complete program in C++ in order to input data and display the output for 50 patients of MPI clinicarrow_forward
- Computer Science C++ Help Write the declaration for a stuct that has the following public data memebers: a string for the name of an insured person, a string for a policy number, floating- point numbers for the insurance amount and premium amount, and an integer for a building type code. Following your struct declaration, write the declaration for stuct varaible and your stuct typearrow_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++ You are required to write three overloaded functions called stringOperation that take in the following formal parameters list: Function 1: takes as input a string, ONE character, and an integer n, and returns true if the string contains that character EXACTLY an n number of times. Function 2: takes as input a string and TWO alphabatical characters c1 and c2, and returns true if all the string characters fall in the range between the two passed characters (exclusive) (You must make sure to order the characters first if c2 < c1 ). Function 3: takes as input a string and THREE alphabatical characters c1, c2 and c3. The function reorders the characters in asecnding order, such that c1 holds the smallest character and c3 holds the largest character. The function returns true if the string characters that fall between c1 and c2 (exclusive) is less than the string characters that fall between c2 and c3 (exclusive). Do not write and submit the main subroutine, or any include…arrow_forwardc++, print the outputarrow_forwardC++arrow_forwardNeed help completing C++ program #include #include #include #include #include static pthread_mutex_t bsem; static pthread_cond_t waitTurn = PTHREAD_COND_INITIALIZER; static int turn; static int nthreads; void *print_in_reverse_order_odd_then_even(void *void_ptr_argv) { // std::cout << "I am Thread " << /*variable identifier*/ << std::endl; return NULL; } int main() { std::cin >> nthreads; pthread_mutex_init(&bsem, NULL); // Initialize access to 1 pthread_t *tid= new pthread_t[nthreads]; int *threadNumber=new int[nthreads]; //HINT: this code determines the starting thread (thread with the highest odd number). //You can erase this if statement if your solution does not need to know the starting child thread number. if ((nthreads-1)%2!=0) turn = nthreads -1; else turn = nthreads -2; for(int i=0;iarrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_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