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

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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