0% found this document useful (0 votes)
1 views

Programming II Written Assignment 2

The document outlines an individual programming assignment with specific tasks related to function prototypes, headers, and calls in C++. It includes questions about program outputs based on user input and requires the creation of functions to perform specific calculations and classifications. The assignment is to be submitted by the next class and is worth 15% of the overall grade.

Uploaded by

teshomenetinfo32
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Programming II Written Assignment 2

The document outlines an individual programming assignment with specific tasks related to function prototypes, headers, and calls in C++. It includes questions about program outputs based on user input and requires the creation of functions to perform specific calculations and classifications. The assignment is to be submitted by the next class and is worth 15% of the overall grade.

Uploaded by

teshomenetinfo32
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Programming II written individual assignment 2 mark out of 15%

Last submition date next class

Give answer based on the given instruction


1. Indicate which of the following is the function prototype, the function header, and

the function call:

a. void showNum(double num) _______________________________

b. void showNum(double); ______________________________

c. showNum(45.67); ________________________________

2. What will the output of the following program be if the user enters 10

#include <iostream> cout << "Enter a number: ";

using namespace std; cin >> input;

void func1() if (input < 10)

{ {

cout << "Able was I\n"; func1();

} func2();

void func2() }

{ else

cout << "I saw Elba\n"; {

} func2();

int main() func1();

{ }

int input; }
3. What is the output of the following program?

#include <iostream> cout << “x= “<<x<< " " << “y=” <<y<< endl;

using namespace std; }

void func1(double , int ); void func1(double a, int b)

int main() {

{ cout << “a=” <<a<< " " <<” b=” <<b<< endl;

int x = 10; a =11.9;

double y = 11.5; b = 107;

cout << “x=” <<x<< " " <<” y=” << y<<endl; cout << “a=” <<a<< " " <<” b=” <<b<< endl;

func1(x, y); }

4. Write a function, named fiveTime, that accepts an integer argument. When the function is called, it
should display the product of its argument multiplied times 5.
5. Write a function named factorial of integer return type which accepts integer argument. The function
prompts the user to enter integer & calculate & display the factorial of the number.
6. Write a function named dailytem, which accept the daily temperature of welkite as an integer
argument. The function should prompt the user to enter the daily temperature of welkite and the
function decides whether the daily temperature of the welkite as cold, moderat , hot or unexpected
weather based on the daily temperature range given below.
1oc - 15oc cold

16oc - 21oc moderate

22oc - 40oc hot

<1oc & >40oc unexpected

You might also like