Write a program that will get the average of all integers from 1 to 20 using do-while loop
Write a generic C++ recursive function PrintPattern2 to print diamond pattern using recursion. No loops allowed whatsoever, and you can write other helping (recursive) functions. For example, calling your function with these argument PrintPattern2(5,1,5) should print following pattern.
Your function prototype must be as follows:
void PrintPattern2(int, int ,int);
Write a program that takes a 2D pointer array and calculate sum of even and odd using recursive
function.
int sum(int **array, int row, int column, int &evenSum, int &oddSum)
Given a string, write a recursive function to find its first uppercase letter. Your function should
return the letter.
Function Prototype: char findUppercase(char* str);
How to execute this using vector
#include <iostream>
int main() {
int size, index, largest, smallest;
std::cout << "How many intergers you want to input? ";
std::cin >> size;
int myarray[size];
std::cout << "Input the elements of the array: ";
for (index = 0; index < size; index++)
std::cin >> myarray[index];
largest = myarray[0];
smallest = myarray[0];
for (index = 0; index < size; index++) {
// largest
if (myarray[index] > largest)
largest = myarray[index];
// smallest
if (myarray[index] < smallest)
smallest = myarray[index];
}
std::cout << "The largest element in the array is: " << largest << ".\n";
std::cout << "The smallest element in the array is: " << smallest << ".\n";
return 0;
}
Write a program that will get the average of all integers from 1 to 20 using do while loop.
create a C++ program for them. Your program should do the following:
1. Read student information for 20 semester 1 students. The student information includes the following:
a) Student name
b) Student surname
c) Student id
d) Program
e) Module code
f) Test one mark
g) Test two mark
h) Project mark
i) Tutorials mark
LIMKOKWING
UNIVERSITY
CREATIVE
j) Final exam mark
2. For the following use functions.
a) Calculate and return the final mark for each student.
Final mark = 10% testl + 15% test2 + 15% tutorial + 20% project +
40% exam
b) Determine the grade using the final mark.
Final mark Grade
80 - 100
70 - 79
60 - 69 c o - 59
40 — 49
30-39 F
c) Find the highest and lowest mark.
d) Find the class average mark.
3. Your program should ask the user if he or she wants a class report or an individual report.
For the experiment Taru has N buckets (numbered from 1,2,3..N) which all are initially empty. She has M number of queries. Each query represents an integer that is of 4 types. Query 1: Fill all the buckets with water •Query 2: Empre even valued buckets (2, 4, 6 N) Query 3: Empty all odd number buckets (1, 3, 5, N). •Query 4: Empty all the buckets (1,2,3. N). You have to return the number of buckets that are filled after performing M queries,using fillbucket function
How to execute this using vector
#include <cmath>
#include <iomanip>
#include <iostream>
using namespace std;
int fibo(int n);
int main() {
string header = " Index Fibonacci number Fibonacci quotient Deviation";
double lim = (1.0 + sqrt(5.0)) / 2.0;
int fib_sequence[21];
for (short i = 0; i < 21; i++) {
fib_sequence[i] = fibo(i);
}
cout << header << endl;
for (short i = 0; i < 20; i++) {
double q = (double)fib_sequence[i + 1] / (double)fib_sequence[i];
cout << setw(5) << i << setw(15) << fib_sequence[i] << setw(20) << fixed
<< setprecision(10) << q << setw(20) << scientific << setprecision(3)
<< lim - q << endl;
}
return 0;
}
int fibo(int n) {
if (n <= 1)
return n;
return fibo(n - 1) + fibo(n - 2);
}
Write a C program using two dimensional arrays that determine the even numbers among the twelve input values from the keyboard and prints the list of these even numbers