C++ Programs Collection provided by http://www.loookinto.blogspot.com/ For More help in c++ programing check this forum http://programmersheaven.usersboard.com here you can post your doubts.
Full description
C++ Programs Collection provided by http://www.loookinto.blogspot.com/ For More help in c++ programing check this forum http://programmersheaven.usersboard.com here you can post your doubts…Descripción completa
c++ programs
c++ programs
c++ programs
mike boyle
Descripción completa
cbse program acceptable in every school
Full description
Solved
trans 6Full description
This e-book has all the solutions for the C exercise programs of Computer Science for Class XII (FBISE).
Fortran
Elitefts Programs Manual
Full description
Descrição: Elitefts Programs Manual
using c++Full description
Write Write a program to calculate absolute value of a number #include
int main() { int absolute(int n); int n; printf("Enter a number to find its absolute value"); scanf("%d",&n); printf("The absolute value of %d is %d ",n,absolute(n)); return 0; } int absolute(int n) { if(n<0) return -n; else return n; }
Output :
Enter a number to find its absolute value -5 The absolute value of -5 is 5
Write a program to negate a number using call by reference #include int main() { int negate(int *n); int n; printf("Enter a number to negate its value \n"); scanf("%d",&n); printf("The negated value is %d",negate(&n)); return 0; } int negate(int *n) { *n=*n * -1; return *n; }
Output :
Enter a number to negate its value 5 The negated value is 5
Write a Program to observe scope of different variables #include using namespace std; int m=10;
// global scope
int main() { int m=20; // local to main { int k=m; int m=30; cout<<"inner block"<
inner block m = 30 k = 20 ::m = 10 outer block m = 20 ::m = 10
Write a function of time using friend function #include
class time { int hh,mm,ss; public: void input() { cout<<"Enter time cin>>hh>>mm>>ss; }
:";
friend time addtime(time temp1, time temp2) { time temp3; temp3.hh=temp1.hh+temp2.hh; temp3.mm=temp1.mm+temp2.mm; temp3.ss=temp1.ss+temp2.ss; if(temp3.ss>59) { temp3.ss=temp3.ss-60; temp3.mm++; if(temp3.mm>59) { temp3.mm=temp3.mm-60; temp3.hh++; }
}
if(temp3.mm>59) { temp3.mm=temp3.mm-60; temp3.hh++; } return temp3; } void output() { cout<
int main() { time t1,t2,t3; t1.input(); t2.input(); t3=addtime(t1,t2); cout<<"Added time is :"; t3.output(); return 0; }
Output :
Enter time : 17 02 50 Enter time : 3 07 50 Added time is:
20:10:40
Write A Program to create a class as a friend of preexisting class #include using namespace std; class myclass { int val; friend class changer; //friend class public: myclass(): val(0){} void input() { cout<<"\nEnter value: "; cin>>val; } void output() { cout<<"\nValue : "<
Output:
Enter value: 10 Value : 10 Modifying value using friend class. Value : 5
Write A Program to demonstrate Copy Constructor #include using namespace std; class num { int x,y; public: num() { x=0; y=0; } num(num &N) { x=N.x; y=N.y; } void input() { cout<<"\nEnter x: "; cin>>x; cout<<"\nEnter y: "; cin>>y; } void output() { cout<<"\nx : "<
Output :