Write a function called sum, that calculates the total value of a and b, where a and b are integers, a= 100 and b = 200 in the main function. Your main function will declare your variables, call the function to add values and then call the function again. When you compile your program it has to give you total result of sum (a, b) from the main function, and the result for sum (a,b) from the function sum. There is a default value of b which is part of the function list, with the value 20. Your function sum, will calculate the result of a and b, and then return the result.
Write a C++ function that determines in which quadrant a line
drawn from the origin resides. The determination of the quadrant
is made using the angle that the line makes with the positive x
axis as follows:
Note: if the angle is exactly 0,90,180,270 degrees the
corresponding line does not reside in any quadrant but lies on an
axis.
Angle from the
positive x axis Quadrant
Between 0 and 90 degrees =1
Between 90 and 180 degrees =2
Between 180 and 270 degrees =3
Between 270 and 360 degrees = 4
Write a C++ program to read and print details of N students. (Note Modify Question number 2)
a. Hints
i. Create a class to hold all student attributes, a method which interact with a user and read student details, method to print/write student details.
ii. Create a main function which will prompt a user to inter N student (Number of students to read and write their details), call function from a class above to read and write student detail.
iii. The user interactive screen and output should appear Sample output
Enter total number of students: 2
Enter details of student 1:
Enter RegNo:101
Enter Name: John Joseph
Enter Course: DIT
Enter Subject: C++ Programming
Enter Score:85.5 Enter details of student 2:
Enter Registration number:102
Enter Name: Josephine Baraka
Enter Course: DIT
Enter Subject: C++ Programming
Enter Score:45
write a program that prompts the user for the size of an array. The program should then ask the user to enter the numbers into the array. The program should then sort the numbers is ascending order and displays the new sorted numbers
Write an if-else statement for the following:
If userTickets is not equal to 6, execute awardPoints = 10. Else, execute awardPoints = userTickets.
Ex: If userTickets is 14, then awardPoints = 10.
create a c++ program with a function named “area” that calculates the area of a rectangle and function named “perimeter”that calculates perimeter of rectangle. Let the user input the data needed for the program.
create a c++ program with a function named average that calculates the average of the students 5 SCORES using array. Let the student enter the scores in the main function and the function average will calculate the average.
Write a program to calculate students’ average test scores and their grades. You may assume the following input data:
Nondo 85 83 77 91 76
Djiara 80 90 95 93 48
Anna 78 81 11 90 73
Salum 92 83 30 69 87
Moloko 23 45 96 38 59
Job 60 85 45 39 67
Feisal 77 31 52 74 83
Kibwana 93 94 89 77 97
Shomari 79 85 28 93 82
Mayele 85 72 49 75 63
Use three arrays: a one-dimensional array to store the students’ names, a (parallel) two-dimensional array to store the test scores, and a parallel one-dimensional array to store grades. Your program must contain at least the following features: read and store data into two arrays, calculate the average test score and grade, and output the results. Have your program also output the class average.
The program will accept some values from the user and will print out the following
1] Details of the user
• Worker ID – Alphanumeric (2 letters and three digits e.g. EF101) Full Name of the worker.
2] Gross Pay (GP)
• GP = Rate * Hours Worked o Rate is a constant of 11.25 ($11.25 per hour) o Hours Worked to be entered by the user.
3] Deduction
• Union fee o Constant of 50 ($50 per member) o Retirement is 10% of GP
4] Take Home Pay (THP)
• THP = GP – Deduction
Instructions
Given code
#include <iostream>
using namespace std;
int main(void) {
char word[100];
cout << "Enter the word: ";
cin >> word;
int result = hasVowel(word);
if(result == 1) {
cout << "There is a vowel in the word \"" << word << "\"";
} else if(result == 0) {
cout << "There is no vowel in the word \"" << word << "\"";
}
return 0;
}
Ex
Enter·the·word:·CodeChum
There·is·a·vowel·in·the·word·"CodeChum"