You are on page 1of 5

Code for Program to read two numbers from the keyboard and

display larger value in C++ Programming


/*www.DailyFreeCode.comDownload Projects,
Sourcecodes, Tips and Tricks, Interview FAQs,
Hotlinks and more....Logon to
www.DailyFreeCode.com*//* Write a program to
read two numbers from the keyboardand display
the larger value on the screen.*/

#include<conio.h>
#include<iostream.h>

class largest
{
int d;
public :
void getdata(void);
void display_large(largest,largest);
};

void largest :: getdata(void)


{
cout<<"\n\nEnter Value :-";
cin>>d;
}

void largest :: display_large(largest o1,largest


o2)
{
if(o1.d > o2.d)
cout<<"\nObject 1 contain Largest Value
"<<o1.d;
elseif(o2.d > o1.d)
cout<<"\nObject 2 contain Largest Value
"<<o2.d;
else
cout<<"\nBOTH ARE EQUAL";
}

void main()
{
largest o1,o2,o3;
clrscr();

o1.getdata();
o2.getdata();

o3.display_large(o1,o2);
getch();
}

de for Program to display string for given number in C++


Programming
/*www.DailyFreeCode.comDownload Projects,
Sourcecodes, Tips and Tricks, Interview FAQs,
Hotlinks and more....Logon to
www.DailyFreeCode.com*//* write a program to
input an integer value from keyboardand display
on screen "WELL DONE" that many times*/

#include<conio.h>
#include<iostream.h>
void main()
{
int n,i;
clrscr();
cout<<"Enter a Number:- ";
cin>>n;
cout<<"\n\n\n";
for(i=0;i<n;i++)
{
cout<<"\t\tWELL DONE\n";
}
getch();
}

Code for Program for Fahrenheit to Celcius using Class in C++


Programming
/*www.DailyFreeCode.comDownload Projects,
Sourcecodes, Tips and Tricks, Interview FAQs,
Hotlinks and more....Logon to
www.DailyFreeCode.com*//* Redo Exercise 2.11
using a CLASS called TEMP andmember functions.*/

#include<iostream.h>
#include<conio.h>

class TEMP
{
float f,c;
public:
float getdata();
void display(void);
};

float TEMP :: getdata()


{
cout<<"Enter Value for farenheit degree to find
for celsius:- ";
cin>>f;
c = (f-32)/1.8;
return(c);
}

void TEMP :: display(void)


{
float v;
v=getdata();
cout<<"CELSIUS DEGREE = "<<v;
}

void main()
{
TEMP c;
c.display();
}

You might also like