What is the output of the following C+ + code? (2, 3)
Want to see the full answer?
Check out a sample textbook solutionChapter 12 Solutions
EP MINDTAPV2.0 FOR MALIK'S C++ PROGRAMM
- Void Do1 (int: &, a. int &b) { a = 5; a = a + b; b = a + 2; } Int main() { Int x = 10; Do1 (x,x); Cout << x << endl; } The output of this program isarrow_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_forwardCode using c++ 2. Solving a Person's Loneliness by CodeChum Admin It's been 1,245 years and our sole Person is getting lonelier each day. This Person definitely needs a partner! Thus, we need to update our Person's design to have a gender as well and there shall be male and female! Instructions: In the code editor, you are provided with the definition of a struct Person. This struct needs an integer value for its age. Furthermore, you are provided with a displayPerson() function which accepts a struct Person as its parameter. Your task is to first update the struct Person so that it can have a gender as well. For this program, we shall represent a gender with a single character: 'M' for male and 'F' for female. Then, create a Person, take in an integer user input and a character user input, and then set them as the Person's age and gender respectively. Finally, call the displayPerson() function and pass that Person you created. Input 1. The age of the Person 2.…arrow_forward
- Please help me in c++ languagearrow_forwardThis 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…arrow_forwardQuestion Write a C++ program that follows the program requirements in the document providedarrow_forward
- c++complete and change #include <iostream>using namespace std; int sumbyrow(int* m, int ncol, int row){int total = 0;for (int i = 0 i < ncol; i++) {total += m[row * ncol + i];}return total; } int sumBCol(int* m, int nrow, int ncol, int col){int total = 0;for (int j = 0; < j nrow; j++) {total += m[j * ncol + col]; }return total;}int sumBYLeftDiag(int* m, int ncol){int total = 0;for (int i = 0, j = ncol - 1; i < ncol && j >= 0; i++, j--) {total += m[i * ncol + j];}return total;}bool hasDuplicates(int* m, int row) {int flatArray[row * row];int k = 0for (int i = 0; i < row; i++) {for (int j = 0; j < row; j++) {flatArray[k++] = m[i * row + j]; }}for (int i = 0; i < (row * row); i++) {for (int j = i + 1; j < (row * row); j++) {if (flatArray[i] == flatArray[j])return true; }}return flase;} bool isMagicMatrix(int* m, int nrow, int ncol) { if (hasDuplicate(m, nrow), int ncol{return false; }if (sumByleftDiag(m, nrow) != sumByRightDiag(m, nrow)) {return…arrow_forwardComputer 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; void myfunction(int num2, int num1); lint main() { my function (5,2); return 0; } void myfunction(int num1, int num2) {if (num1>3) cout << "A1"; else if (num1<3) cout<<"A2"; else cout<<"A3";} O A2 O A1 O A3 A1 A2 A3arrow_forward
- Question Write a C++ program that follows the program requirements in the document provided Declare a struct called Circuit that includes three member variables: Resistor Capacitor Frequency Write a value returning function that includes the relevant parameters to calculate the capacitive impedance using Write a value returning function with the relevant parameters that calculates the magnitude of the reactance based on an object's resistor value and calculated impedance and returns the result. Note: Z = R-jXc Wnite a value returning function with the relevant parameters that caicuiases the angle of the reactance based on an object's resistor value and calculated impedance and returns the result. Note: Z = R-jX Complete you program by writing a main function and by adding any other selesant hnes of code. Declare two objects of the struct Circuit. The user of the program should be asked to enter the resistance, capacitance and frequency of two circuits. Thereactance of cach circuit…arrow_forward#include using namespace std3; int main() { int x-6; int y=103; int z=0; int q=1; Z+= X-- -ys q*=++z+y; cout<arrow_forwardC++ 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_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
- 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