#include<iostream>
#include<fstream>
using namespace std;
int main()
{
ifstream infile;
ofstream ofile;
infile.open("E:\\BSCS.txt");
ofile.open("E:\\BCS.txt");
int n1,n2,n3;
infile>>n1>>n2>>n3;
if(n1 > n2 && n1 > n3)
{
ofile<<" Number1 is Maximum"<<endl;
}
else if(n2 > n1 && n2 > n3)
{
ofile<<" Number2 is Maximum"<<endl;
}
else if(n3 > n2 && n3 > n1)
{
ofile<<"Number3 is Maximum"<<endl;
}
else if(n1==n2 && n1>n3)
{
ofile<<"number 1 and number 2 are equal but greater than number3."<<endl;
}
else if(n2==n3 && n2>n1)
{
ofile<<"number 2 and number 3 are equal but greater than number1."<<endl;
}
else if(n3==n1 && n3>n2)
{
ofile<<"number 1 and number 3 are equal but greater than number2."<<endl;
}
else
{
ofile<<"all three numbers are equal"<<endl;
}
infile.close();
ofile.close();
cout<<"your output from the input data of text file \"BSCS\", has been written in da text file \"BCS\""<<endl;
return 0;
}
#include<fstream>
using namespace std;
int main()
{
ifstream infile;
ofstream ofile;
infile.open("E:\\BSCS.txt");
ofile.open("E:\\BCS.txt");
int n1,n2,n3;
infile>>n1>>n2>>n3;
if(n1 > n2 && n1 > n3)
{
ofile<<" Number1 is Maximum"<<endl;
}
else if(n2 > n1 && n2 > n3)
{
ofile<<" Number2 is Maximum"<<endl;
}
else if(n3 > n2 && n3 > n1)
{
ofile<<"Number3 is Maximum"<<endl;
}
else if(n1==n2 && n1>n3)
{
ofile<<"number 1 and number 2 are equal but greater than number3."<<endl;
}
else if(n2==n3 && n2>n1)
{
ofile<<"number 2 and number 3 are equal but greater than number1."<<endl;
}
else if(n3==n1 && n3>n2)
{
ofile<<"number 1 and number 3 are equal but greater than number2."<<endl;
}
else
{
ofile<<"all three numbers are equal"<<endl;
}
infile.close();
ofile.close();
cout<<"your output from the input data of text file \"BSCS\", has been written in da text file \"BCS\""<<endl;
return 0;
}
No comments:
Post a Comment