Showing posts with label Acees Class Member. Show all posts
Showing posts with label Acees Class Member. Show all posts
Saturday, 28 January 2012
Program Of Pointer Function ( Call By Refrence) In C
#include<stdio.h>
#include<conio.h>
int sum(int *x,int *y); // Fnction Declatration
main()
{
int a,b,c;
clrscr();
printf("Enter NUmbers=");
scanf("%d%d",&a,&b);
c=sum(&a,&b); // Function Call
printf("\n NAswer = %d",c);
getch();
}
int sum(int *x,int *y) // Function Define
{
int z;
z= *x + *y;
return z;
}
Program Of Logical Operators In C
#include<stdio.h>
#include<conio.h>
main()
{
int a,b,c;
clrscr();
printf("Enter First Number=");
scanf("%d",&a);
printf("Enter Second Number=");
scanf("%d",&b);
printf("Enter Third Number=");
scanf("%d",&c);
if(a>b && a>c)
{
printf("\n A is Greater");
}
if(b>a && b>c)
{
printf("\n B is Greater");
}
if(c>a && c>b)
{
printf("\n C is Greater");
}
getch();
}
--------------------------------------------------------------
The Not operator performs logical negation on a Boolean expression. Put simply, it yields the opposite of the expression it evaluates. If the expression evaluates to True, Not yields False; if the expression evaluates to False, Not yields True. An example is shown below:
Dim x As Boolean x = Not 23 > 12 ' x equals False. x = Not 23 > 67 ' x equals True.
The And operator performs logical conjunction on two Boolean expressions. That is, if both expressions evaluate to True, then the And operator returns True. If either or both expressions evaluate to False, then And returns False.
The Or operator performs logical disjunction on two Boolean expressions. If either expression evaluates to True, Or returns True. If neither expression evaluates to True, Or returns False.
Xor performs logical exclusion on two expressions. If either expression evaluates to True, but not both, Xor returns True. If both expressions evaluate to True or both expressions evaluate toFalse, Xor returns False.
Wednesday, 25 January 2012
Program To Access Class Member In C++
#include<iostream.h>
#include<conio.h>
class Add
{
Private:
ont a;
Public:
int b;
void display( )
{
a=8;
b=9;
cout<<"\n a="<<a; //can be access
cout<"\ b ="<<b; // can be access
}
};
main( )
{
clrscr()
Add a1;
a1.display( );
// cout<<"\n private value of class ="<<a1.a;
// can't be Access
cout <<"\n public value of class="<<a1.b;
getch();
}
Subscribe to:
Posts (Atom)
