100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Exam (elaborations)

CIS 115 A+ complete solution

Rating
-
Sold
-
Pages
34
Grade
A+
Uploaded on
12-08-2024
Written in
2024/2025

CIS 115 A+ complete solution

Institution
CIS 115
Course
CIS 115











Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
CIS 115
Course
CIS 115

Document information

Uploaded on
August 12, 2024
Number of pages
34
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Content preview

Cis 115

1. printTodaysDate();: printTodaysDate
is a function that accepts no parameters and returns no value.
Write a statement that calls printTodaysDate
.
2. void printDottedLine(){
cout<<" .... \n";
}: Write the definition of a function
printDottedLine
, which has no parameters and doesn't return anything.
The function prints a single line consisting of
5
periods (terminated by a new line character) .
3. void printTodaysDate();: Write a statement that declares a prototype for a func-
tion
printTodaysDate
, which has no parameters and doesn't return anything.
4. printErrorDescription(14);: printErrorDescription
is a function that accepts one
int
parameter and returns no value.
Write a statement that calls the function
printErrorDescription
, passing it the value
14
.
5. printLarger(sales1,sales2);: printLarger
is a function that accepts two
int
parameters and returns no value.
Two
int
variables,
sales1
and
sales2
, have already been declared and initialized.
Write a
statement
that calls


, Cis 115

printLarger
, passing it
sales1
and
sales2
.
6. void printLarger(int one,int two){
if(one>two)
cout<<one<<endl;
else
cout<<two<<endl;
}: Write the definition of a function
printLarger
, which has two
int
parameters and returns nothing. The function prints the larger value of the two
parameters on a single line by itself. (For purposes of this exercise, the "larger"
means "not the smaller".)
7. int add(int,int);: Write a statement that declares a prototype for a function named
add
which has two
int
parameters and returns an
int
.
8. eurasiaSales=add(asiaSales,euroSales);: add
is a function that accepts two
int
arguments and returns their sum.
Two
int
variables,
euroSales
and
asiaSales
, have already been declared and initialized. Another
int
variable,
eurasiaSales


, Cis 115

, has already been declared.
Write a statement that calls the
add
function to compute the sum of
euroSales
and
asiaSales
and store this value in
eurasiaSales
.
9. int oneLess(int amount){
return amount-1;
}: Write the definition of a function named
oneLess
, which receives an
int
argument and returns an
int
that is one less than the value of the argument. So if the argument's value is
7
, the function returns the value
6
. If the argument's value happens to be
44
, the functions returns the value
43
10. int half(int amount){
return amount/2;

}: Write the
definition
of a function named
half
, which receives an integer argument and returns an integer that is
half
the value of the parameter. (Use integer division!)
So if the argument's value is
7
, the function returns the value


, Cis 115

3
.
If the argument's value happens to be
44
, the functions returns the value
22
.
11. bool isPositive(int num){
if(num>0){
return true;
}
else{
return false;

}
}: Write the definition of a function named isPositive, that receives an integer argu-
ment and returns true if the argument is positive, and false otherwise.

So, if the argument's value is 7 or 803 or 141 the function returns true.

But if the argument's value is -22 or -57, or 0, the function returns false
12. int counter(){
static int x=0;
return x++;
}: Write the definition of a function named
counter
that receives no parameters and returns
0
the first time it is invoked, returns
1
the next time it is invoked, then
2
,
3
and so on.
13. double timeOnHighway(double mileEndingPoint,
double mileStartingPoint=0.0, double speed=55.0){
return (mileEndingPoint-mileStartingPoint)/speed;
}: Write the definition of a function named
$3.49
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
sylvianthiwa
2.5
(2)

Also available in package deal

Thumbnail
Package deal
CIS 115 Week 1 iLab: Building a Registration Form and Pay Calculator in Python.
-
4 2024
$ 13.96 More info

Get to know the seller

Seller avatar
sylvianthiwa Teachme2-tutor
View profile
Follow You need to be logged in order to follow users or courses
Sold
6
Member since
1 year
Number of followers
6
Documents
577
Last sold
6 months ago
A+ Nursing Guides

I understand how frustrating assignments can be. As a nurse, I have essential guides that have received A grades. I\'m a very friendly person and always happy to help.

2.5

2 reviews

5
0
4
1
3
0
2
0
1
1

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions