#include <iostream>
#include <cstring>
using namespace std;
#define STR_MAX_SIZE 100
void preserveString(char*, int);
int main(void) {
char str[STR_MAX_SIZE];
cout << "Enter string: ";
fgets(str, STR_MAX_SIZE, stdin);
preserveString(str, strlen(str));
return 0;
}
void preserveString(char *str, int size) {
if(size > 0) {
for(int i = 0; i < size - 1; i++) {
cout << str[i];
}
cout << endl;
// TODO: Add the recursive case of the function here
}
}
please help me to add the recursive function thankyou
Create a class heater that contains a single integer field temperature. Define a constructor that takes no parameter. The temperature field should be set to the value 15 in the constructor. Define the mutates warmer and cooler, whose effect is to increase or decrease the value of the temperature by 5.
Objective:
Write a program that asks the user for the name of a file. The program should display
the last 10 lines of the file on the screen (the “tail” of the file). If the file has fewer than
10 lines, the entire file should be displayed, with a message indicating the entire file
has been displayed.
NOTE:
Using an editor, you should create a simple text file that can be used to test this
program.
26. Suppose that the tuition for a university is $10,000 this year and Write a program that computes the tuition in ten years and the total cost of four years"
increases 5% every year.
worth of tuition starting ten years from now. 27. Write a program that convert from kilograms to pounds, miles to kilometers, and from
hour to minutes based on the choice of the user. 28. Write a program that prompts the user to enter the number of students and each student's
name and score, and finally displays the student with the highest score and the student
with the second-highest score.
29. Write a program that prompts the user to enter the number of students and each student's name and score, and finally displays the name of the student with the highest score.
2. Write a float method triangle() that computes the area of a triangle using its two formal parameters h and w, where h is the height and w is the length of the bases of the triangle.
3. Write a float method rectangle() that computes and returns the area of a rectangle using its two float formal parameters h and w, where h is the height and w is the width of the rectangle.
4. The formula for a line is normally given as y= mx +b. Write a method Line() that expects three float parameters, a slop m, a y-intercept b, and an x-coordinate x. the method computes the y-coordinate associated with the line specified by m and b at x coordinate.
5. Write a method Intersect() with four float parameters m1.b1.m2,b2. The parameters come conceptually in two pairs. The first pair contains the coefficients describing one line; the second pair contains coefficients describing a second line. The method returns I
if the two lines intersect. Otherwise, it should return 0;
Creat a class called class1 and class2 which each of having one private data members .Add member function to set value say 'set value' on each class. Add one more function max() that is friendly to both classes and max() function should compare two private member of two classes and show maximum among them
write c++ program using a dynamic arrays to assign seats to pessenger
0. Exit the program
1. Table
2. Factorial
3. Prime, Composite, Even, Odd
4. Arithmetic Operations
5. Grading System
6. Area of Triangle
7. Series (1 + 1/1! + 1/2! + 1/3! + … + 1/n!)
8. Finding maximum and minimum number in an array
9. Matrix calculation
10. Student record and display along with their result in c++
Example:
Base integer = 3
Initial factor = 2
Number of times to process = 3
Process:
1.) 2 x 3 = 6
2.) 6 x 3 = 18
3.) 18 x 3 = 54
Therefore, the output would above would be 54.
Instructions: