Examlex

Solved

The Following Program Has Been Partitioned into Two Files

question 20

Essay

The following program has been partitioned into two files.The command line command for compiling this is CC B.cpp A.cpp,where CC is the name for your command line compiler.For VC++ this is CL,for Borland,this is BCC32,and for the GNU C++ compiler,this is g++.If you use an IDE (integrated development environment)you would have to place both these files in your project then click the compile button.
Predict the output and explain your prediction.
// This goes in file A.cpp
namespace
{
int func(int i)
{
return i*3;
}
int junk (int i)
{
return i*func(i);
}
// This goes in file B.cpp
#include <iostream>
int func(int i)
{
return i*5;
}
int junk(int i);//from A.cpp
int main()
{
cout <<"func(5)= " << func(5)<< endl;
cout <<"junk(5)= " << junk(5)<< endl;
}


Definitions:

Return On Stockholders' Equity

A measure of financial performance calculated by dividing net income by average shareholders' equity, showing how effectively management uses equity from shareholders to generate profit.

Preferred Dividends

Payments made to preferred shareholders of a company before dividends are paid to common shareholders, typically fixed and paid at regular intervals.

Average Common Stockholders' Equity

It represents the average equity stake that common shareholders have in a company over a certain period, calculated by averaging the opening and closing common stockholders' equity balances.

Earnings Per Share

A financial indicator that divides a company's profit by the outstanding shares of its common stock, measuring the company's profitability per share.

Related Questions