C++ Answers

Questions answered by Experts: 9 913

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

A drink costs 2 dollars. A taco costs 4 dollars. Given the number of each, compute total cost and assign totalCost with the result. Ex: 4 drinks and 6 tacos yields totalCost of 32.

#include <iostream>

using namespace std;

int main() {

  int numDrinks;

  int numTacos;

  int totalCost;

  cin >> numDrinks;

  cin >> numTacos;

  /* Your solution goes here */

  cout << "Total cost: " << totalCost << endl;

  return 0;

}

Q1.You are required to write a computer program that accepts a decimal number and generates a corresponding binary, octal, and hexadecimal output.

Q2. Write a program that accepts binary input string and generates corresponding octal and hexadecimal outputs respectively.


C++: Write a program that sets a secret password (programmer's discretion). Ask the user to guess the password. If the guess is correct then print "You got it " Otherwise, print "Nope".

Use dynamic list to declare array of 10 integers, then write the following function:

(show the output for each function)

1-   Insert an integer at the beginning of the array

2-   Delete the last element of the array

Using the code stub below, write a statement that assigns finalResult with the sum of num1 and num2, divided by 3. Ex: If num1 is 4 and num2 is 5, finalResult is 3.

#include <iostream>

using namespace std;

int main() {

  int num1;

  int num2;

  int finalResult;

  cin >> num1;

  cin >> num2;

  /* Your solution goes here */

  cout << "Final result: " << finalResult << endl;

  return 0;

}



Q1.You are required to write a computer program that accepts a decimal number and generates a corresponding binary, octal, and hexadecimal output.

Q2. Write a program that accepts binary input string and generates corresponding octal and hexadecimal outputs respectively.


Write a program that declared a class with one integer data member and two member functions for input data and output data. Decide appropriate access modifiers for these members. Use this class in your program.


Define a class TEST in C++ with following description:Private MembersTestCode of type integerDescription of type stringNoCandidate of type integerCenterReqd (number of centers required) of type integerA member function CALCNTR() to calculate and return the number of centers as(NoCandidates/100+1)Public Members - A function SCHEDULE() to allow user to enter values for TestCode, Description, NoCandidate & call function CALCNTR() to calculate the number of Centres- A function DISPTEST() to allow user to view the content of all the data members  


"cin.ignore();" what type of cin statement is this and how it is used in a program?


Define a class batsman with the following specifications:Private members:bcode 4 digits code numberbname 20 charactersinnings, notout, runs integer typebatavg it is calculated according to the formula  batavg =runs/(innings-notout)calcavg() Function to compute batavgPublic members:readdata() Function to accept value from bcode, name, innings,   notout and invoke the function calcavg()displaydata() Function to display the data members on the screen.  


LATEST TUTORIALS
APPROVED BY CLIENTS