(Geometry: area of a regular polygon) A regular polygon is an n-sided polygon in which all sides are of the same length and all angles have the same degree (i.e., the polygon is both equilateral and equiangular). The formula for computing the area of a regular polygon is Here, s is the length of a side. Write a program that prompts the user to enter the number of sides and their length of a regular polygon and displays its area. Here is a sample run:
Consider the following function definition:
int func(int x, double y, char u, string name) {
//function body
}
Which of the following are correct function prototypes of the function func?
a. int func(x, y, u, name);
b. int func(int s, double k, char ch, string name);
c. int func(int, double, char, string);
d. func(int, double, char, string
how to get right angle triangle when input is 5
2. The distance from Point A to Point B is n meters(n>2). A person goes from point A to point B walking by taking steps of size 2 meters or 3 meters. Please write a program to find the total number of ways in which the person can do this. The program should take n as input. For e.g., if input n = 5 the output should be 2, since the person can do this in two ways:
1. Take 2 steps followed by 3 steps.
2. Take 3 steps followed by 2 steps.
Create a program that checks as to which stage an age is
The tap code, sometimes called the knock code, is a way to encode text messages on a letter-by-letter basis in a very simple way. Tap code has been one of the most basic communication protocols and still used to convey SOS messages and other urgent communication. The tap code uses a 5×5 grid of letters representing all the English alphabets, see Figure 1. To communicate the word "water", the cipher would be the following (with the pause between each number in a pair being shorter (single space) than the pause between letters (two spaces)),
A B C/K D E
F G H I J
L M N O P
Q R S T U
V W X Y Z
Your task is to design a program that can
i) convert any given string into a Tap code sequence
Prototype: char* convertToTapCode(char*)
ii) and A Tap code sequence to a string (char*)
Prototype: char* convertToString(char*)
Note:
1) only use following library :
#include <iostream>
Note: however, you can use char*
helping link
http://yamm.finance/wiki/Tap_code.html
In a car race game, when a car object is created it should be filled with fuel, and placed at certain x,y coordinates. Once the game is over, all cars should be deleted ? How do you handle it using c++ classes. Write suitable c++ code
Define a structure for electricity board, the structure members customer name, unit consumed, sub charge and total charge. Implement the C program to calculate charges of the following rates for the energy consume,
Number of Units Cost per Unit
· For the first 200 units Rs. 5 per unit
· For the next 100 units Rs. 8 per unit
· For the next and above 300 units Rs. 10 per unit
The users are charged a minimum of Rs. 200/- as meter charge, and then an additional surcharge of 5% of total amount is charged. Read the customer names and number of units consumed as input and display the customer name, sub charges and total charge
Input :
Gopinath
150
Output :
Customer Name: Gopinath
Sub Charge: 37.50
Total Charge: 987.50
Implement a C program for file operations to read a string from standard input and prints the entered string using fgets() and fputs() function.
Note: Create the text file, fstring.txt
Input :
Hai
Output :
Hai
Define a structure for electricity board, the structure members customer name, unit consumed, sub charge and total charge. Implement the C program to calculate charges of the following rates for the energy consume,
Number of Units Cost per Unit
· For the first 200 units Rs. 5 per unit
· For the next 100 units Rs. 8 per unit
· For the next and above 300 units Rs. 10 per unit
The users are charged a minimum of Rs. 200/- as meter charge, and then an additional surcharge of 5% of total amount is charged. Read the customer names and number of units consumed as input and display the customer name, sub charges and total charge