Ticket #6243: templates.txt

File templates.txt, 725 bytes (added by anonymous, 10 years ago)
Line 
1#include "stdafx.h"
2
3#include<iostream>
4#include<string.h>
5#include<conio.h>
6 using namespace std;
7template<class t>
8
9
10void swap(t &x,t &y)
11{
12 t temp=x;
13 x=y;
14 y=temp;
15}
16
17void fun(int a,int b,float c,float d)
18{
19 cout<<"a and b before swaping :"<<a<<"\t"<<b;
20 swap(a,b);
21 cout<<"\na and b after swaping :"<<a<<"\t"<<b;
22 cout<<"\n\nc and d before swaping :"<<c<<"\t"<<d;
23 swap(c,d);
24 cout<<"\nc and d after swaping :"<<c<<"\t"<<d;
25}
26
27void main()
28{
29 int a,b;
30 float c,d;
31 cout<<"Enter A,B values(integer):";
32 cin>>a>>b;
33 cout<<"Enter C,D values(float):";
34 cin>>c>>d;
35 fun(a,b,c,d);
36
37
38}
39int _tmain(int argc, _TCHAR* argv[])
40{
41 return 0;
42}
43