Hollow Right Triangle - 2
Given an integer number
The first line of input is an integer
In the given example the hollow right angled triangle of side
5. Therefore, the output should be
*
* *
* *
* *
* * * * *
Sample Input 1
4
Sample Output 1
*
* *
* *
* * * *
Sample Input 2
5
Sample Output 2
*
* *
* *
* *
* * * * *
Type two statements that use rand() to print 2 random integers between (and including) 100 and 149. End with a newline. Ex:
101
133
Note: For this activity, using one statement may yield different output (due to the compiler calling rand() in a different order). Use two statements for this activity. Also, srand() has already been called; do not call srand() again.
#include <cstdlib> // Enables use of rand()
#include <ctime> // Enables use of time()
using namespace std;
int main() {
int seedVal;
cin >> seedVal;
srand(seedVal);
/* Your solution goes here */
return 0;
}
Using the code stub below, type a statement using srand() to seed random number generation using variable seedVal. Then type two statements using rand() to print two random integers between (and including) 0 and 9. End with a newline. Ex:
5
7
Note: For this activity, using one statement may yield different output (due to the compiler calling rand() in a different order). Use two statements for this activity. Also, after calling srand() once, do not call srand() again.
#include <iostream>
#include <cstdlib> // Enables use of rand()
using namespace std;
int main() {
int seedVal;
cin >> seedVal;
/* Your solution goes here */
return 0;
}
Using the code stub below, write a program that reads a person's first and last names, separated by a space. Then the program outputs last name, comma, first name. End with newline.
Example output if the input is: Akua Mperey
Mperey, Akua
#include <iostream>
#include <string>
using namespace std;
int main() {
string firstName;
string lastName;
/* Your solution goes here */
return 0;
}
Using the code stub below, output all combinations of character variables a, b, and c, in the order shown below. If a = 'x', b = 'y', and c = 'z', then the output is:
xyz xzy yxz yzx zxy zyx
Your code will be tested in three different programs, with a, b, c assigned with 'x', 'y', 'z', then with '#', '$', '%', then with '1', '2', '3’.
#include <iostream>
using namespace std;
int main() {
char a;
char b;
char c;
cin >> a;
cin >> b;
cin >> c;
/* Your solution goes here */
cout << endl;
return 0;
}
Print a message telling a user to press the letterToQuit key numPresses times to quit. End with newline.
•Ex: If letterToQuit = 'q' and numPresses = 2, print:
#include <iostream>
using namespace std;
int main() {
char letterToQuit;
int numPresses;
cin >> letterToQuit;
cin >> numPresses;
/* Your solution goes here */
return 0;
}
Create a class called myMath. This class only contains one basic data type (float x). Your class should mimic the +,-,*,/ function in a basic data type. In other words, you need to provide the basic math operations for the objects created under myMath.
main()
{
myMath m1(10),m2(2),m3; //you can change 10 and 2 to any value to test your code.
m3 = m1 + m2;
cout <<"\nAddition: "<< m3.getX(); //output is 12
m3 = m1 - m2;
cout <<"\nSubtraction: "<< m3.getX(); //output is 8
m3 = m1 * m2;
cout <<"\nMultiplication: "<< m3.getX(); //output is 20
m3 = m1 / m2;
cout <<"\nDivision: "<< m3.getX(); //output is 5
}
Years, Weeks & Days
Write a Python program of Years, Weeks & Days. It consists of two test cases
The below link contains Years, Weeks & Days - Question, explanation and test cases
https://drive.google.com/file/d/1hYY-kPr5I9do_Lcmq4XFLKyewJMM9zVT/view?usp=sharing
We need all test caese can be come while code was running
Women Population
Write a Python program of Women Population. It consists of two test cases
The below link contains Women Population - Question, explanation and test cases
https://drive.google.com/file/d/1IaJ7mLXUDjUKpY6A57Pgr87X0cRm62Cm/view?usp=sharing
We need all test caese can be come while code was running
Area and Perimeter of Square
Write a Python Program of Area and Perimeter of Square.It Consists of two test cases
The below link contains Area and Perimeter of Square - question, explanation and test cases
https://drive.google.com/file/d/1i6HbDoWuKPpNJvNtHbsXAB6xrOlYdP8g/view?usp=sharing
We need all test cases can be come while code was run