Misc. Programs In C++ //This is a program for copy desired file. //You can use this program as garbage with ur program. #include #include #include #include void main() { ifstream infile; ofstream outfile; ofstream printer; char filename[20]; cout<<" Enter the desired file to copy."; cin>>filename; infile.open(filename,ios::nocreate); if(!infile) { cout<<"Input file can not be opened."< #include class college { private: char collegename[80]; public: college() { strcpy(collegename,"XXX"); } char * getcollegename() { return collegename; } }; class student:public college { private: char studname[40]; char address[80]; public: student(char *name) { strcpy(studname,name); } char * studentname() { return studname; } setaddress(char *add) { strcpy(address,add); } char * studentaddress() { return address; } }; #include #include void main() { clrscr(); studentfile student; student.studentname("XXX"); getch(); }; #include #include #include //Declare a function with one required parameter void display(int number,...); void main() { int index=5; int one=1,two=2; clrscr(); display(one,index); getch(); } void display(int number,...) { va_list para; va_start(para,number); cout<<"The parameters are:"< #include void main() { clrscr(); printf("%d %d",sizeof(NULL),sizeof("")); getch(); } #include #include void main() { int a=10,b=20; clrscr(); swapv(&a,&b); printf(" A=%d",a); printf(" B=%d",b); getch(); } swapv(int *x,int *y) { int t; t=*x; *x=*y; *y=t; return; } /* This is the program using pointer to swap values */ #include #include void main() { int a=10,b=20; clrscr(); nilesh(a,b); printf(" A=%d",a); printf(" B=%d",b); getch(); } nilesh(x,y) { int t; t=x; x=y; y=t; printf(" X=%d",x); printf(" Y=%d",y); return; }