C++ program to use multiple functions

#include <iostream>
using namespace std;
void ReadData();
void AddData(int,int,int);
void DisplayData(int);
int main()
{
    ReadData();
    return 0;
}

void ReadData()
{
    int a,b,c;
    cout<<"Enter three numbers:"<<endl;
    cin>>a>>b>>c;
    AddData(a,b,c);
}

void AddData(int x, int y, int z)
{
    int sum=x+y+z;
    DisplayData(sum);
}

void DisplayData(int s)
{
    cout<<"The sum is: "<<s;
}

No comments:

Post a Comment