Head Ads

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

Share:

Q1 Write a program that inputs two numbers ‘swap the values and displays them.

Also, Make the Automata of C++ Program 

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

Hi, there in this article I will write a program that will input the  2 numbers ‘ and then I will swap the values and then displays the output of the program. So let's see the solution. Write a program that inputs two numbers ‘swap values and displays all values.

Answer.

Here is the answer of the question, write a program that inputs two numbers ‘swap the values and displays them also making the automata of C++ program

#include<iostream.h>
#include<conio.h>
// Global variables
Int x;
Int y;
Int z;
 Void take data ();
void process data ();
Void show data ();
 Void main ()
{
Take data ();
Process data ();
Show data ();
}
Void take data () 
{
Cout <<” input taken from user “;
}
Void process data ()
    {
Cout <<” swapping the values of the numbers “;
}
Void show data ()
      {

     Cout << “display the swap numbers “ ;
}

Here are the automata of the C++ program

"<yoastmark

2
                   a                       b                           c                   
1
3
4

x     1’2 =   take data from the user.
y     2,3 = process on the data
z     3’4 = show data / result
1 is the initial state
4 is the ending state

 How does this program work?

In this short and C++ programming tutorial, I tried to show you how to work with C++ using Automata. In this simple program, I just want to show you how to work with variables and many more things.
The theory of automata shows how automatically works the programs and C++ programs show how to work accordingly.
In this program, the variables will show their data with the Cout function to displays the data. void take data function makes enable the user to put data into the program. Void process data function processing the data.
Void Show data function shows data in the program.

How was this program? 

I tried my best to make the program very simple and easy. Every programmer has its own style of programming. Some have their very great programming methods. I guess I have a better. But your comments will tell me how I manage the programs in this short problem-solving article.

Your feedback is important for me

Give me feedback on how I work if you like let me know in the comment section. I will love to see your comments and if you have any query I will solve your query as soon as possible.
My other article related to this Article Write a program that inputs two numbers ‘swap values and displays
What is a Programming Language? | Basics of Programming Language
How to be a Programmer | Easy Ways To Gain Programming Skills

No comments

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