Skip to content
Get 50% Off with Promo Code: BlackFriday21
Check it Out
Home
Marketing
Expertise
Automation
Business Coach
Marketing – vCMO
Development
About Matthew Maennche
Resources
C++ Solutions Map
Java Solutions Map
Visual Basic Solutions Map
FAQ
Contact
Log In
C++
Learn To Code
1662 Posts
Java
826 Posts
Visual Basic
232 Posts
Python
30 Posts
Business
9 Posts
General
7 Posts
Classic ASP
4 Posts
PHP
4 Posts
Web Development
1678 Posts
FPDF
2 Posts
BuddyPress
2 Posts
Content Management
2 Posts
Javascript
2 Posts
HTML
1 Post
SQL
1 Post
CRM's
1 Post
Microsoft Dynamics CRM
1 Post
Random
1 Post
Search
Write a recursive, int -valued function, len, that accepts a string and returns the number of characters in the string. The length of a string is: 0 if the string is the empty string (“”””). 1 more than the length of the rest of the string beyond the first character.
View Solution
Two non-negative integers x and y are equal if either: – Both are 0, or – x-1 and y-1 are equal Write a bool-function named equals that recursively determines whether its two int parameters are equal and returns true if they are and false otherwise.
View Solution
Write a function called fact that recursively calculates the factorial value of its single int parameter. The value returned by fact is a long..
View Solution
Write the definition of a function called product. The function receives two int parameters. You may assume that neither parameter is negative. The function returns the product of the parameters. So, product (3,5) returns 15 and product (30,4) returns 120. The function must not use a loop of any kind (for, while, do-while) to accomplish its job.
View Solution
Assume the availability of a function called fact. The function receives an int argument and returns an int value. If the argument is one or smaller, it returns the integer value one. Otherwise it returns the product of all the integers from one to its argument. So the value of fact(4) is 1*2*3*4 and the value of fact(10) is 1*2*3*4*5*6*7*8*9*10. Assume further that the variable k has been declared and initialized to a positive integer. Assume further that the variable x has been declared as an integer type. Write a statement that assigns x the value k*(k-1)*(k-2)*…*3*2*1 by calling the fact function and multiplying its return value by k. Note: your solution must include multiplying fact’s return value by k here.
View Solution
Assume the availability of a function called printStars. The function receives an int argument. If the argument is positive, the function prints (to standard output) the given number of asterisks. Thus, if the printStars(8) is called, ******** (8 asterisks) will be printed. Assume further that the variable starCount has been declared and initialized to a positive integer. Write some code that prints starCount asterisks to standard output by: first printing a single asterisk (and no other characters) then calls printStars to print the remaining asterisks.
View Solution
Assume the availability of a function named printStars that can be passed a non-negative integer n and print a line of asterisks. Write a function named printTriangle that receives a non-negative integer n and prints a triangle of asterisks as follows: first a line of 1 asterisk, followed by a line of 2 asterisks, and then a line of 3 asterisks, and so on and finally a line of n asterisks. For example, if the function received 5 it would print: * * * * * * * * * * * * * * * The function must not use a loop of any kind (for, while, do-while) to accomplish its job. The function should invoke printStars to accomplish the task of printing a single line.
View Solution
Write a statement that reads 5 successive integers into these variables that have already been declared: x1 x2 x3 x4 x5. Then write a statement that prints each out on its own line so that they form a right-justified column with a 5-digit width. If any of the integers are 5-digits in size, then they will start at the very beginning of their lines. For example: |54213 | 8713 | 23 | 147 | 15 NOTE: The vertical bar,|, on the left above represents the left edge of the print area; it is not to be printed out. Also, we show x in the output above to represent spaces–your output should not actually have x’s!
View Solution
Given three variables, a, b, c, of type double that have already been declared and initialized, write some code that prints each of them in scientific (also known as e-notation or exponential notation) in a 10 position field on the same line. Each number should be printed with 3 digits to the right of the decimal point. For example, if their values were 987654321, 1234, 0.00987654321, the output would be: |x9.877e+08×1.234e+03×9.877e-03 NOTE: The vertical bar, |, on the left above represents the left edge of the print area; it is not to be printed out. Also, we show x in the output above to represent spaces–your output should not actually have x’s!
View Solution
Given three variables , a, b, c, of type double that have already been declared and initialized, write some code that prints each of them in a 15 position field on the same line, in such away that scientific (or e-notation or exponential notation) is avoided. Each number should be printed with 5 digits to the right of the decimal point. For example, if their values were 24.014268319, 14309, 0.00937608, the output would be:|xxxxxxx24.01427xxxx14309.00000xxxxxxxx0.00938 NOTE: The vertical bar, | , on the left above represents the left edge of the print area; it is not to be printed out. Also, we show x in the output above to represent spaces– your output should not actually have x’s!
View Solution
Given three variables, a, b, c, of type double that have already been declared and initialized, write a statement that prints each of them on the same line, separated by one space, in such away that scientific (or e-notation or exponential notation) is avoided. Each number should be printed with 5 digits to the right of the decimal point. For example, if their values were 4.014268319, 14309, 0.00937608, the output would be:|4.01427×14309.00000×0.00938 NOTE: The vertical bar, |, on the left above represents the left edge of the print area; it is not to be printed out. Also, we show x in the output above to represent spaces– your output should not actually have x’s!
View Solution
Write a statement that reads 5 successive integers into these variables that have already been declared : x1 x2 x3 x4 x5. Then write a statement that prints each out on its own line so that they form a right-justified column with a 5-digit width. If any of the integers are 5-digits in size, then they will start at the very beginning of their lines. For example: |54213 |8713 |23 |147 |15
View Solution
« Previous
1
…
5
6
7
8
9
…
49
Next »