printMultTable(int, int);
Q: 1. Write a readEmployee function that takes a pointer to an employee struct and fills in the…
A: #include <stdio.h> #include <stdlib.h> struct employees { char name[20]; int…
Q: What is the output of the code? #include #include void modify(int x, int y, int z) std::cout <<…
A: Modifying the given program code: #include <iostream> #include <iomanip> using…
Q: Program 7.13 #include #include using namespace std; int main() { const int MAXPOINTS = 100; int i,…
A: #include <iostream>#include <cmath>using namespace std; int main(){ const int…
Q: What is the output of the program below? #include #include using namespace std; void…
A: PROGRAM CODE: #include <iostream>#include <string> using namespace std; void…
Q: 1) Define a global variable Emps that is an array of pointers to employee structs. 2) Change your…
A: According to the question , we have to solve 5 parts in the questions but we will discuss first…
Q: What is the output of the code? #include <iostream> #include <iomanip> void modify(int…
A: Modifying the given program code: #include <iostream> #include <iomanip> using…
Q: Although it will no longer be used, please leave the earlier global variable with the initialized…
A: Clarification:-Here I have made the capacity named readEmployee(), inside the capacity I have taken…
Q: What will be the output of the following C++ code? #include #include using…
A: Question. What will be the output of the following C++ code? #include <iomanip>…
Q: #include using namespace std; char let; int Final (int &num1, int num2); double Final (double…
A: Given: #include <iostream> using namespace std; char let; int Final (int &num1, int num2);…
Q: I keep getting these errors when I run the code below: Code is in C++ ____animal.cpp_______…
A: Answer: horsemain.cpp: #include "horse.h"#include<limits>#include<cstdlib> void…
Q: What is the output of the code?
A: Modifying the given program code: #include <iostream> #include <iomanip> using…
Q: What is the output of the following code? #include <iostream> using namespace std;int main() {…
A: #include <iostream>using namespace std;int main() {int matrix[4][4] ={{1, 2, 3, 4}, {4, 5, 6,…
Q: Although it will no longer be used, please leave the earlier global variable with the initialized…
A: Here I have created a function named readEmployee(). In this function, I have taken input from the…
Q: consider the following code * #include using namespace std; int main() { double wages, hours,…
A: If the working hours is between 1 to 40 then, totalWages = (rate * hours) If the working hours is…
Q: Although it will no longer be used, please leave the earlier global variable with the initialized…
A: Memory Layout of C Programs A typical memory representation of a C program consists of the…
Q: Please run this code and rectify the issue in string #include #include int binarySearch(int arr[],…
A: code
Q: /I need help debugging the C code below the image is what I was following for directions while doing…
A: The Above Code is Debug Success full:
Q: 2 #include using namespace std; void func1(int &) ; void func2 (int &, int &) ; void func3 (int,…
A: In func1,func2: Arguments are passed to the function by sending the reference not value. So any…
Q: Find and Correct Errors and print output #include using namespace std; int fun(int a, char…
A: Please upvote for my efforts. !. ANSWER code: #include<iostream>using namespace std; void…
Q: #include using namespace std; int main() { int a = 5, b = 10, c = 15; int *arr[ ] = {&a, &b,…
A: Dear learner hope you are doing well !, I will try my best to answer this question. Thank You!!
Q: what is wrong with this programming? #include #include using namespace std; int main() { string…
A: #include <iostream>#include<bits/stdc++.h>using namespace std;int main(){string…
Q: Hinclude Hinclude ciomanip> using namespace std; void test(int first, int& second); int main () int…
A: The output is below:
Q: For the following code #include #include int powerof(int base, int pow); int _tmain(int argc,…
A: powerof is a function that takes two parameters base and pow
Q: ?What will be the output of the following C++ code Please select the best answer tinclude using…
A: We are given a piece of code and we need to determine the correct output of it. Language : C++ Code…
Q: Please trace the code and give the correct output
A: Program Instructions:After adding the necessary cstring header file and formatting the output, the…
Q: What is the output of the following code? #include <iostream> using namespace std;int main() {…
A: Code: #include <iostream>using namespace std;int main(){ int matrix[4][4] = {{1, 2,…
Q: What will be the output of the following C++ code? #include #include using namespace std;…
A: The answer is...
Q: What will the following program display on the screen? #include <iostream> using namespace…
A: #include <iostream> using namespace std;class Tank{private:int gallons; public:Tank(){ gallons…
Q: what is the following code ?produce #include using namespace std; int pc(int a, int b) { if (b ==…
A: Answer : Greatest Common Divisor of a and b let's say we take a=2 and b=4 here b != 0 so it will…
Q: This C program handles values only up to $99.99. Please modify to handle values up to $999.99.…
A: To handle values up to $999.99, you need to write more code for calculation. Like you have done for…
Q: 2) #include struct uu 11 8 5 8 11 11 5 15 int x; struct uu *p; }; struct uu fun(struct uu d) d.x *=…
A: Structure: It is similar to class. It holds the variable of different data types under the same…
Q: What will be the output of the following C+ + code? #include using namespace std; class Rect { int…
A: Question. What will be the output of the following C++ code? a) recta area: 30 rectb area: 42 b)…
Q: Program 03 1. Winclude 2. using namespace std; 3. int main() 5. char select; 6. 7. do( 8.…
A: the program given below
Q: Will the following code display the larger of the two values? Answer the question and explain your…
A: Given program: #include <iostream>using namespace std; void find_larger(int v1,int v2, int…
Q: Show the output of the following code. #include <iostream> using namespace std;int* f(int…
A: The code will shows the error.
Q: What does the following code output? tinclude void pointerUpd (double* upt); int main() { double*…
A: The C++ code given in the problem: #include <iostream>void pointerUpd(double* upt); int…
Q: #include using namespace std; int rectArea (int len, int wid) { return len * wid; } int main…
A: The given program is to calculate the area of rectangle given length and width of rectangle.
Q: //I need help debugging the C code below the image is what I was following for directions while…
A: SUMMARY: - Hence, we discussed all the points.
Q: the output of the following C++ code? #include using namespace std; int main ( ) {…
A: Question. The output of the following C++ code? #include <iostream> using namespace…
Q: Following code is for 4×4 tic toc toe game covert this code in to 3×3 players. Code
A: Given :- Following code is for 4×4 tic toc toe game covert this code in to 3×3 players.
Q: Need output #include #include using namespace std; int main(int argc, char const *argv[]) {…
A: We are given a C++ code and we are going to find out its output. We are given an array of characters…
Q: c++complete and change #include using namespace std; int sumbyrow(int* m, int ncol, int row) {…
A: Note : I am considering that you are facing some logical error in this code which is not…
Q: need help debugging the C code below the image is what I was following for directions while doing…
A: // creating the pointer struct employees *emp = malloc(sizeof(struct employees)); //…
Q: Please fix this code for me, I'm stuck . #include #include using namespace std; // the main…
A: The error is because, you have used swet(w). It is not swet(width). It is setw(width) There are…
Q: int_tmain(int argc, _TCHAR* argv[]) { int A=35, B=65; if(A>=40 || B<=75) { cout<<"lf will execute";…
A: The given problem is related to C++ programming and operators in the programming. The requirement is…
Q: #include #include #include using namespace std; int main() { int monthlyUsage[12]; double…
A: Process Explanation : The above C++ code is used for calculating consumption of electricity in each…
Q: OWhat is the esact output of the programs below? A- void main ) main() int x4, while (x0) cout endl,…
A: removing void main() from the 1st code because it will produce wrong output like this : So to…
Q: b) #include 27.0 #includeciostream> using namespace std; void main(){ int x = 2; int y = 5; ? cout…
A: Question 1: part a: code: #include<iostream>using namespace std;int main() {…
Q: std; const int ROWS = 3; const int COLS = 3; const int MIN = 1; const int MAX = 9; bool…
A: It is defined as a graphical representation of steps. It shows steps in sequential order and is…
Q: (a) int *ptrl=&a, a; int *ptrl, a; (b) ptrl=&a; (c) int *ptrl; int a; ptrl=&a; (d) int *ptr2, a,…
A: “Since you have asked multiple questions, we will solve the first question for you. If you want any…
In this code, what does "int printMultTable(int, int);" mean ?
#include <stdlib.h>
#include <iostream>
#include <iomanip>
using namespace std;
int printMultTable(int, int);
int main()
{
int randRow, randCol, row, col, value;
char option = 'Y';
do{
cout<<"Find the wrong number in the multiplication table below:";
cout<<"\n(the program will print the full table along with a wrong number inserted in it.)\n";
randRow = rand()%10+1;
randCol = rand()%10+1;
value = printMultTable(randRow,randCol);
cout<<"\nEnter the row and column of the incorrect value: ";
cin>>row>>col;
if(row == randRow && col == randCol){
cout<<"Right!\n";
} else {
cout<<"Wrong! The incorrect value is in cell "<<randRow<<" and "
<<randCol<<" and should be "<< value <<"\n";
}
cout<<"\nPlay again?[y/n]:\n ";
cin>>option;
//cout<<"\n";
}while (option!='n');
return 0;
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- In the following program with struct student, which has name and age. There is a pointer to struct student *ptr, but does not assign a value to it. Then, there is a print statement for ptr->age. 1. Why does an error occur when the program is run? #include <stdio.h> //make struct student struct student { charname[25]; int age; }; int main() { //declare pointer to struct student struct student *ptr; //print ptr -> age printf("%d", ptr->age); return0; }This code is correct but can you do call this createKidPerson() in the main Code: #include <iostream>using namespace std; typedef struct { int age; char gender;} Person; void displayPerson(Person); Person createKidPerson(Person father, Person mother); int main(void) { Person father; Person mother; father.gender = 'M'; mother.gender = 'F'; cout<<"Enter the Male Person's age: "; cin>>father.age; cout<<"Enter the Female Person's age: "; cin>>mother.age; Person kid = createKidPerson(father, mother); displayPerson(kid); return 0;} Person createKidPerson(Person father, Person mother){ Person p; if((father.age==mother.age) && (father.age%2==1)){ p.gender='F'; } else if(father.age>=mother.age) p.gender='M'; else p.gender='F'; p.age=1; return p;}void displayPerson(Person p){ cout << "\nPERSON DETAILS:" << endl;…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…
- Not sure how to fix the getIndex function please help --------------------------- #include <iostream> #include <cassert> using namespace std; class SomeObj{ public: SomeObj(int d ): id(d){} int getId() const; void output(); private: int id; }; int SomeObj::getId() const{ return id; } void SomeObj::output(){ cout<<id<<endl; } template<typename T> class MyArray { public: MyArray(); MyArray(int c); T& operator[](int index); void push_back(T e); int getSize() const; int getCapacity() const; int getIndex(T a); void erase(); private: void grow(); T *data; int capacity; int size; }; template <typename T> MyArray<T>::MyArray(): MyArray(1) { } template <typename T> MyArray<T>::MyArray(int c) { assert(c>0); size = 0; capacity = c; data = new T[capacity]; } template <typename T> T& MyArray<T>::operator[](int index) {…using this c++ code add these improvements -want to ignore whitespace -allow number #include <stdio.h> #include <ctype.h> #include <stdlib.h> int lookahead; void expr(void); void rest(void); void term(void); void match(int); void error(void); int main(void) { lookahead = getchar(); expr(); putchar('\n'); /* adds trailing newline character */ } void term(void) { if (isdigit(lookahead)) { putchar(lookahead); match(lookahead); } else error(); } void match(int t) { if (lookahead == t) lookahead = getchar(); else error(); } void error(void) { printf("syntax error\n"); /* print error message */ exit(1); /* then halt */ } void expr(void) { term(); while ( 1) { if (lookahead == '+') { match('+'); term(); putchar('+'); } else if (lookahead == ' - ') { match(' - '); term(); putchar(' - '); } else break; } }#include <stdio.h> struct Single { int num; }; void printSingle(int f) { int binaryNum[33]; int i = 0; while(f>0) { binaryNum[i] = f % 2; f = f/2; i++; } for (int j=i-1; j>= 0; j--) { printf("%d",binaryNum[j]); } } int main() { struct Single single; single.num = 33; printf("Number: %d\n",single.num); printSingle(single.num); return 0; }
- my code is displayed below, just need help with this question in c++. #include <iostream>using namespace std; class Vehicle{private: string *brand;public: Vehicle(){ brand = new string; *brand = "TBD"; } Vehicle(string b){ brand = new string; *brand = b; } void output(){ cout << "Brand: " << *brand << endl; } void setBrand(string b){ *brand = b; } string getBrand(){return *brand;}}; class Car:public Vehicle{private: int *weight;public: Car():Vehicle(){ weight = new int; *weight = 0; } Car(string b, int w):Vehicle(b){ weight = new int; *weight = w; } void output(){ cout << "Brand: " << getBrand() << " Weight: " << *weight << endl; } void setWeight(int w){ *weight = w; } int getWeight(){return *weight;}}; class Boat:public Vehicle{private: int *hullLength;public: Boat():Vehicle(){ hullLength = new int; *hullLength = 0; } Boat(string b, int h):Vehicle(b){ hullLength =…C++ #include <string>#include <cmath> class DollarAmount {public:// initialize amount from an int64_t valueexplicit DollarAmount(int64_t value) : amount{value} { } // add right's amount to this object's amountvoid add(DollarAmount right) {// can access private data of other objects of the same classamount += right.amount; } // subtract right's amount from this object's amountvoid subtract(DollarAmount right) {// can access private data of other objects of the same classamount -= right.amount;} // uses integer arithmetic to calculate interest amount, // then calls add with the interest amountvoid addInterest(int rate, int divisor) {// create DollarAmount representing the interestDollarAmount interest{(amount * rate + divisor / 2) / divisor}; add(interest); // add interest to this object's amount} // return a string representation of a DollarAmount objectstd::string toString() const {std::string dollars{std::to_string(amount / 100)};std::string…this code is in c++ and i having trouble making It run this is my first time working with classes and header files main.cpp #include <iostream>#include<iomanip>#include <string>#include"Pet.h"#include "Pet.cpp" using namespace std; int main(){Pet* myPets[2];myPets[0] = new Pet("Fluffy", 2);myPets[1] = new Pet("Frisky", 4);for (int day = 1; day <= 9; day++){cout << "======= Day " << day << endl;for (int k = 0; k < 2; k++) {careFor(myPets[k], day);}}cout << "=======" << endl;for (int k = 0; k < 2; k++){if (myPets[k]->alive()) {cout << "Animal Control has come to rescue "<< myPets[k]->name() << endl;}delete myPets[k];}return 0;} pet.cpp #include<iostream>#include "Pet.h" Pet::Pet(std::string nm, int initialHealth){m_name = nm;m_health = initialHealth;} void Pet::eat(int amt){if (amt < 0)return;m_health += amt;// Increase the pets health by the amount} void Pet::play(){m_health--;// Decrease pets…
- Please rewrite the code: Here is the code: class PidManager {// Declare the range of possible pid valuesprivate static final int MIN_PID = 300;private static final int MAX_PID = 5000; // Declare a memory locationprivate static int[] pids; // Create a method named allocatMap().// This method is used to allocate the// memory to store the pids.public static int allocatMap() {pids = new int[MAX_PID - MIN_PID];if (pids == null) {System.out.println("Memory allocation failed.");return -1;} for (int i = 0; i < pids.length; i++) {pids[i] = 0;}System.out.println("Memory allocated successfully.");return 1;} // Create a method named allocatPID().// This method is used to allocates and returns a pid.public static int allocatPID() {if (pids == null) {System.out.println("PID Manager is not initialized ");return -1;} int pidNum = -1; for (int i = 0; i < pids.length; i++) {if (pids[i] == 0) {pids[i] = 1;pidNum = i + MIN_PID;break;}}if (pidNum == -1) {System.out.println("Unable to allocat…C++ #include <iostream>using namespace std; //creating struct to hold //student name,age and letter gradestruct student{ //data members string name; int age; char grade;};int main(){ //declaring object for the struct student *k = new student; //filling it with data k->name = "Kate"; k->age=24; k->grade='B'; ///then printing student data cout<<"Name:"<<k->name<<endl; cout<<"Age:"<<k->age<<endl; cout<<"Grade:"<<k->grade<<endl; return 0;}in Java please This program will store roster and rating information for a soccer team. Coaches rate players during tryouts to ensure a balanced team. (1) Prompt the user to input five pairs of numbers: A player's jersey number (0 - 99, but this is NOT enforced by the program nor tested) and the player's rating (1 - 9, not enforced like jersey numbers). Store the jersey numbers in one int array and the ratings in another int array. Output these arrays (i.e., output the roster) as shown below after inputting the data. Ex Enter player 1's jersey number: 84 Enter player 1's rating: 7 Enter player 2's jersey number: 23 Enter player 2's rating: 4 Enter player 3's jersey number: 4 Enter player 3's rating: 5 Enter player 4's jersey number: 30 Enter player 4's rating: 2 Enter player 5's jersey number: 66 Enter player 5's rating: 9 ROSTER Player 1 -- Jersey number: 84, Rating: 7 Player 2 -- Jersey number: 23, Rating: 4 . . . (2) Implement a menu of options for a user to modify the roster. Each…