hello please i need help ASAP QUICKLY
Write down a complete C++ program that will use the following
functions related with a triangle;
a) a function that will let the user to input the and to return the
sizes of the three sides, let say a, b, c.
b) a function that will calculate and return the area of the
triangle; Area=(1/2)(a+b+c)
c) a function that will print the sizes of the triangle and its
area on the screen.
Then use these functions in a logical order in a main program.
Solution:
Code:
#include<iostream> using namespace std; //Function definitions int * get_sides(); float calculate_area(int a,int b,int c); void Print_details(int a,int b,int c,float area); int main() { int a,b,c,*side; //Function call to get 3 sides from user and storing it in a,b,c side = get_sides(); a=*side; b=*(side+1); c=*(side+2); //Function call to calculate area and store it in area float area=calculate_area(a,b,c); //Function call to print the details. Print_details(a,b,c,area); } int * get_sides() { int a,b,c; cin>>a>>b>>c; //Static array static int side[3]; side[0]=a; side[1]=b; side[2]=c; //will return the address of the static array side return side; } float calculate_area(int a,int b,int c) { float area=(float)(a+b+c)/2; return area; } void Print_details(int a,int b,int c,float area) { cout<<"side a: "<<a<<endl; cout<<"side b: "<<b<<endl; cout<<"side c: "<<c<<endl; cout<<"Area : "<<area<<endl; }
Output:
hello please i need help ASAP QUICKLY Write down a complete C++ program that will use...
Write a C++ program using user defined functions that will read in the lengths of two side of a right triangle and then calculate the length of the hypotenuse. The program should do this twice. The program should the following user defined functions: Function readA will read in a value for side A from the user and return it to main. (it will not receive any input data from main) Function readB will read in a value for side B...
Hello please help asap under 30 mins please. in C++ Programming 2.Write down a function that will input three integers to be used in the main application such that these integers and their average should be returned to the main. Write a set of statements that will call this function and displays the numbers and their average 2. Write down a function that will input three integers to be used in the main application such that these integers and their...
Please help c++ Heron's Formula for the area of a triangle with sides a, b and c is given by the formula: area = S(S-a) (S-b) (S-c) where s = (a+b+c)/2 Write a complete program which in main asks the user for the sides a, b and c of a triangle. Use variables of type double. Pass a, b and c to a function called area. In area calculate s defining s as a local variable. Then use s, a,...
1. Write a C++ program that reads sides of a triangle a, b and c from a file and computes the area of a triangle and counts total number of areas program has computed Program should have two functions sfun(): sfun receives the values of a, b and c then computes and returns the value ofs as areafun 0: areafun receives the value of s and computes and return the area of a triangle to main program using below formulae...
You are to write a program IN C++ that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: if the an item's wholesale cost is 5.00 and its markup percentage is 100%, then the item's retail price is 10.00 If an item's wholesale cost is 5.00 and its markup percentage is 50%, then the item's retail price is 7.50 Program design specs. You should have 5...
8. (15 marks) Write a complete C program, which uses an array of structures and two user defined functions. The program deals with a library database. The program will ask the user to input required information about each book and store it in a structure in a user defined function called get info. The second user defined function display_info will display database information on the screen. The output should look as follows: Book Title Book ld 123456 C Programming 10...
Hello. I just need help with my c++ code. Write a program that: Creates an integer variable AND an integer pointer variable Ask the user to input an integer value Store the value in the integer variable Print the address of the variable. Make the pointer variable point at the integer value Print the value pointed to by the pointer Print the address of the pointer
Hello, I need help with these two functions blockPrint and wordPrint.The program is written in C. Thank you. ent the prototype for blockPrint. a) Intextfunctions.h, uncon Write the function definition for block Print dentical characters on a separate line. (See example This function should print each group (block) of ident output below) Example: Example: Incoming string: "Tbeehiklssuy Output (to the screen): Incoming string: "Java Programming Output to the screen: ee POOH da al Edit vour main function.include test calls and...
project 5 functions calling functions white a program that determines if 3 numbers that are entered, by the user, are sides of a right triangle. remember any combination of numbers can be entered, 3 4 5, 5 4 3, 4 3 5... are all the same right triangle. you must have a function that does exponentiation, one that does input one that does output. and one that does the comparisons the main will be this code main: jal allwork li $v0,10 syscall function allwork will...
Help write down below program with C++ language!!! Please... The Cipher Program Requirements An interactive program is required that allows a user to encode text using any of three possible ciphers. The three ciphers you are to offer are: Caesar, Playfair and Columnar Transposition. • The program needs to loop, repeating to ask the user if they wish to play with Caesar, Playfair or Columnar Transposition until the user wishes to stop the program. •For encoding, the program needs to...