Please help me to answer the following problems, I am new with the c++ code,

Write a c++ program that may be use to compute the area of square (area=sideside) or a triangle (area=1/2base*height). After prompting the user to type the first character of the figure name (S or T) if S you will compute the area of square, if T you will compute the area of trianglE.

2
Contributors
1
11
Views
4 Years
Discussion Span
Last Post by Learner010

I am new with the c++ code,

I'm also new , and new user can learn and finally becomes expert.And c++ is very easy to learn.

Write a c++ program that may be use to compute the area of square (area=sideside) or a triangle (area=1/2base*height).

i think nobody will write for you.you should do your homework with your own efforts.we will try to solve it ,if prove that you played much with the code but unable to find the solution.

After prompting the user to type the first character of the figure name (S or T) if S you will compute the area of square, if T you will compute the area of trianglE.

try this:

``````char ch;
cin>>ch;
if(ch=='s')
//call related function
else if(ch=='t')
//call related function
``````

subprogram is another term for function/subroutine. It is very easy to learn and Here is my tutorial on functions in c++.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.