void = blank

walkingarmadaΛογισμικό & κατασκευή λογ/κού

18 Νοε 2013 (πριν από 3 χρόνια και 9 μήνες)

86 εμφανίσεις

Object Oriented Programming

C.I.T


1

|
P a g e



void = blank

stdio.h = standard input/output header files

conio.h = console input/output header files

{ = start body

} = end body

printf = print formatted

getch = get character

; = terminator

\
a = beep sound

\
n = next line

\
t = eight time space

% =
reminder operator

& = address operator



Object Oriented Programming

C.I.T


2

|
P a g e


Practical No. 1


#include<stdio.h>

#include<conio.h>

void main(void)

{

printf(“Hello World”);

getch();

}



Object Oriented Programming

C.I.T


3

|
P a g e


Practical No. 2


#include<stdio.h>

#include<conio.h>

void main(void)

{

printf(“Welcome To C++”);

getch();

}




Object Oriented Programming

C.I.T


4

|
P a g e


Practical No. 3


#include<stdio.h>

#include<conio.h>

void main(void)

{

int age;

printf(“Enter Your Age”);

scanf(“%d”,&age);

getch();

}




Object Oriented Programming

C.I.T


5

|
P a g e


Practical No. 4


#include<stdio.h>

#include<conio.h>

void main(void)

{

int age;

printf(“Enter Your Age”);

scanf(“%d”,&age);

printf(“You are %d years old”,age);

age=age+10;

printf(“After 10 years you will be %d years old”,age);

getch();

}



Object Oriented Programming

C.I.T


6

|
P a g e


Practical No. 5


#include<stdio.h>

#include<conio.h>

void main(void)

{

int num1,num2,result;

printf(“Enter Num1”);

scanf(“
%d”,&num1);

printf(“Enter Num2”);

scanf(“%d”,&num2);

result=num1+num2;

printf(“the sum of %d and %d is %d”,num1,num2,result);

getch();

}



Object Oriented Programming

C.I.T


7

|
P a g e


Practical No. 6


#include<stdio.h>

#include<conio.h>

void main(void)

{

int a;

for(a=0;a<5;a++)

printf(“Pakistan”);

getch();

}



Object Oriented Programming

C.I.T


8

|
P a g e


Practical No. 7


#include<stdio.h>

#include<conio.h>

void main(void)

{

int a,i;

for(a=0;a<5;a++)

for(i=0;i<5;i++)

printf(“Pakistan”);

getch();

}



Object Oriented Programming

C.I.T


9

|
P a g e


Practical No. 8


#include<stdio.h>

#include<conio.h>

void main(void)

{

char ch;

ch=getche();

if(ch=='y')

printf("
\
nYou type y");

getch();

}



Object Oriented Programming

C.I.T


10

|
P a g e


Practical No. 9


#include<stdio.h>

#include<conio.h>

void main(void)

{

char ch;

ch=getche();

if(ch==’y’)

printf(“
\
nYou type y”);

else

printf(“
\
n You did not type y”);

getch();

}



Object Oriented Programming

C.I.T


11

|
P a g e


Practical No. 10


#include<
stdio.h>

#include<conio.h>

void main(void)

{

int x,y;

for(x=1;x<9;x++)

{

for(y=1;y<9;y++)

if((x+y)%2==0)

printf("
\
xDB
\
xDB");

else

printf("");

printf("
\
n");

getch();

}

}

Object Oriented Programming

C.I.T


12

|
P a g e


Practical No. 11


#include<stdio.h>

#include<conio.h>

void main(void)

{

int x,y;

for(x=1;x<24;x++)

{

for(y=1;y<24;y++)

if(x==y||x==24
-
y)

printf("
\
xDB");

else

printf("
\
xBO");

printf("
\
n");

getch();

}

}

Object Oriented Programming

C.I.T


13

|
P a g e



Practical No. 12


#include<stdio.h>

#include<conio.h>

void main(void)

{

int temp;

printf(“Please type the temperature”);

scanf(“%d”,&
temp);

if(temp<60)

if(temp<40)

printf(“Nice day”);

else

printf(“Sure is hot”);

getch();

}



Object Oriented Programming

C.I.T


14

|
P a g e


Practical No. 13


#include<stdio.h>

#include<conio.h>

void main(void)

{

int temp;

printf("Please type the temperature");

scanf("%d",&temp);

if(temp<60)

if(temp<40)

printf("Sure is chilly");

else

printf("Sure is hot");

else

printf("Nice day");

getch();

}