What input parameters the function takes

Assignment Help C/C++ Programming
Reference no: EM13968855

C++ Homework

1. What are the two types of comment styles in C++?

2. Find 3 errors in the following program

// This is a little program

that calculates a modulus answer.

int main()

{

   double x,y,answer;

   answer = x%y;

   cout << "\n\n answer = << answer;

   return 0;

     }

3. What output is generated from running the following program?

#include <iostream>

using namespace std;

void Red();

int main()

{

      int i = 1;

      while(i < 4)

      {

            Red();

            ++i;

      }

}

void Red()

{

      cout << "\nRed is a great color.";

}

4.  Salma wrote the following program:

#include <iostream>

#include <cmath>

using namespace std;

int main()

{

      float square;

      float x = static_cast<float>(- 3.7755);

      square = x * x;

      cout << "The square of " << x;

      cout << "\nis equal to " << square << endl;

      system("pause"); // so that the screen stays up till user hints a key

      return 0;

}

Salma wants to put the underlined C++ code (above) in a separate function and wants to call it squareIt. Put the above code in a MS Visual Studio C++ project. Compile it and make sure it compiles fine and runs correctly.

What you are required to do:

Rewrite Salma's program by creating the function squareIt(). Call the function squareIt() from within the main() function. Recompile the code and make sure it compiles and runs fine and produces the same results.

When you create the function think about

1.  What the function will do

2.  what input parameters the function takes.

3.  What results it returns to the calling program.

4.  How it is called in the main.

5.  Do not forget to create a prototype for it at the top of the program.

Reference no: EM13968855

Questions Cloud

What are the advantages for a donor of participating : What types of recipient organizations are best-suited to SVP-type funding? If all Philanthropy were to move to this model, would any nonprofits be hurt?
What is the internal rate of return : Calculate the Net Present Value for the capital budgeting proposal - What is the Payback in years - What is the (IRR) Internal Rate of Return?
Appropriate testing hypothesis problem : Formulate the appropriate testing hypothesis problem and carry out the test if a = 0.05.
Design a table describing the dimensions of culture : Design a table describing the five dimensions of culture proposed by Hofstede. Include the managerial implications of these dimensions and a comparison of Hofstede's findings with those of Trompenaars' and the GLOBE project team
What input parameters the function takes : What input parameters the function takes.  What results it returns to the calling program.  How it is called in the main.  Do not forget to create a prototype for it at the top of the program.
Describe the type of business you have created : The product or service, and general staffing plan. Provide a rationale for your plan.
Determine the timing a pendulum swing or a drop time : What do you conclude about the accuracy of your measurement technique - Define uncertainties Are they SD, SEM or confidence intervals? Always state the sample size.
What is the main advantage of the micro-kernel approach : What is the main advantage of the micro-kernel approach to system design? How do user programs and system services interact in a micro-kernel architecture?
What happens if you delay start of savings for 5 years : Once you add up all the future values from step 2 above, and do a time line to determine how much you will be able to spend each year assuming you are going to spend all your money

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Program to count the number of heart beat

If a human heart beats on the average of once a second, how many times does the heart beat in a lifetime of n years? (Use 365.25 for days in a year). Write a program to count the number of heart beat.

  Tcp terminate the new connection

If a copy of the old FIN is delivered, will TCP terminate the new connection? Why or why not? Can a router send request to another router for TCP connection? Give reason.

  Determining the types of employees

An organization has two types of employees, salaried and wage earning. Both the types of employees have some common properties, such as employee code, employee name, and employee address.

  Write some code that puts a zero in every element of q

Given a two-dimensional array of integers named q, with 2 rows and 4 columns, write some code that puts a zero in every element of q. Declare any variables needed to help you.

  Write the definition of the member function two of yclass

Write the definition of the member function two of yClass so that the private member variable a is initialized to the value of the first parameter of two, and the private member variable b is initialized to the value of the second parameter of two..

  Sockets for this problem you will implement a client-server

sockets for this problem you will implement a client-server version of the rock-paper-scissors-lizard-spock game which

  What is the output

Suppose that x and y are int variables, z is a double variable, and ch is a char variable. Suppose the input statement is.

  Program specifications for a simple business problem

Given a set of program specifications for a simple business problem utilizing a modular design, code and test a program that meets the specifications and employs best programming practices.

  Create a program that reads in two integers

Create a program that reads in two integers and then has a pointer point to the first variable and then to the second variable.

  Make program using switch statements in visual basic/c++

Enter the year code, course code, number of units and output the year name, course name, tuition fee and the balance tuition fee of the student.

  Problem related to permutation

Write a recursively function that generates all the permutations of a set of numbers. Use the STL set class for all set operations and the STL linked list class to store and manipulate each individual permutation. When creating a set containing li..

  Compute the area of a pentagon

Evaluate the area of a pentagon given by the coordinates - Please make sure it compiles and write the full program to receive full credit. Thank you so much for your help.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd