Head Ads

Write a Program that Inputs Base and Height from the User | C++

Share:

Write a Program that Inputs Base and Height from the User | C++ Programming

Write a Program that Inputs Base and Height from the User
Write a Program that Inputs Base and Height from the User

In this useful C++ program I will show in this program that inputs base and height from the user. Write a Program that Inputs Base and Height from the User will make sense to show you how to write a program. This will calculate and displays the area of a triangle by using the formula area= 1/2 *Base *Height. In this short tutorial, I will show you the complete program source code and also provide you the automata of the program. The automata of the program will show you the process of the program.

Q3 write a program that inputs base and height from the user.

It calculates and displays the area of a triangle by using the formula Area = ½ *Base *Height.

Answer.
#include<iostream.h>
#include<conio.h>
// Global variables
Int a;
Int b;
Int c;
 Void take data ();
Void process data ();
Void show data ();
 Void main ()
{
Take data ();
Process data ();
Show data ();
}
Void take data ()
{
Cout <<” inputs the base and height “;
}
Void process data ()
    {
Cout <<”calculate the aria of triangle “;
}
Void show data ()
      {

     Cout << “displays the results  “;
}
Automata of the program


2
                   a                       b                           c                   
1
3
4

a     1’2 =   take the inputs from the user  .
b     2,3 = process .
c     3’4 = show data / result
1 is the initial state
4 is the ending state

Related Articles to check other C++ Programming using automata programs.

Write a program that inputs the Distance traveled and speed of the vehicle

Write a program that inputs two numbers ‘swap values and displays

What is a Programming Language? | Basics of Programming Language

History of Programming languages 

is HTML a programming language? | what is HTML?

How to be a Programmer | Easy Ways To Gain Programming Skills

No comments

Note: Only a member of this blog may post a comment.