hello
what is a far pointer?
Recommend me some good books on data structures and algos
hello
what is a far pointer?
Recommend me some good books on data structures and algos
last if condition is not working . if the no is not fount then it should print not found but it is doing something else
hello guys . the code is doin well
enter sorted integers and num to be searched
the problem is in the last if condition
#include<iostream.h>
#include<conio.h>
#define siz 10
void main()
{
int arra[siz]={0};
int mid,beg=1,end=siz,loca=0,num;
clrscr();
cout<<"Please Enter The Elements Of Array\n";
for(loca=0;loca<siz;loca++)
{
cin>>arra[loca];
}
cout<<"Please enter the required number";
cin>>num;
mid=(loca)/2;
while(beg<end&&arra[mid]!=num)
{
if(num<arra[mid])
end=mid-1;
else
beg=mid+1;
mid=(beg+end)/2;
}
if (arra[mid]!=num)
cout<<"\nnot found";
else if (arra[mid]==num)
cout<<"location is\t"<<mid;
getch();
}
hello.
My name is Muhammad Saqib , I am from pakistan.
I am doing A degree in computer Scienc From CIIT Attock.
(www.ciit.edu.pk)
I am in first semistor. Currently Learning C language.
Best Wishes.
Peace.
Thanks.
hello guys,
the following code is taken from my senior. i am unable to under stand its logic .
because i am new in graphics can u guys kindly explain its logics
thanks.
#include<graphics.h>
#include<conio.h>
#define left 0
#define top 0
#define right 639
#define bottom 479
#define radius 20
void main ()
{
int gdriver = DETECT, gmode, errorcode;
int x,y,dx,dy,oldx,oldy;
unsigned char ballbuff[2000];
initgraph(&gdriver, &gmode, "");
rectangle(left, top, right,bottom);
x=left+radius+10;
y= top+radius +10;
setbkcolor(BROWN);
setcolor(LIGHTGREEN);
setfillstyle(SOLID_FILL,YELLOW);
circle(x,y,radius);
floodfill(x,y,LIGHTGREEN);
getimage(x-radius,y-radius,x+radius,y+radius,ballbuff);
dx=2;dy=2;
while(!kbhit())
{
putimage(x-radius,y-radius,ballbuff,COPY_PUT);
oldx=x;oldy=y;
x+=dx;y+=dy;
if(x==left+radius+2||x>=right-radius-2)
dx=-dx;
if(y==top+radius+2||y>=bottom-radius-2)
dy=-dy;
putimage(oldx-radius,oldy-radius-2,ballbuff,XOR_PUT);
delay(1);
}
getch();
closegraph();
}
Where is it not working? If ithere are compile errors, give us the error messages. At first glance
getche();
should be changed togetchar();
no there r no errors
my if condition is not working properly
thanks for ur help
yes i want to check wethere word Palindrome
or not
I am using Turbo C ,what should i use instead of clrscr();
hi guys , what i am trying to do is ,to take a word as
input from user and reverse its order like world
into dlrow and tell the user that the word is same or not after reversing its order
Here is the code please check it cause it is not working
#include<stdio.h>
#include<conio.h>
void main()
{
char name[10]={0,0,0,0,0,0,0,0,0,0};
char namre[10]={0,0,0,0,0,0,0,0,0,0};
int i=0,a=0,j,q=0,num=0;
clrscr();
printf("Please Enter The Number Of Leters In Your Word");
scanf("%d",&num);
printf("enter\n");
for(i=0;i<num;i++)
{
name[i]=getche();
a++;
}
printf("\n");
q=a;
for(j=0;j<a;j++)
{
q--;
namre[q]=name[j];
if(namre[q]==name[j])
{
printf("the word is same");
break;
}
else
{
printf("the word is not same");
break;
}
}
getch();
}
the temperature program is runing now
#include<stdio.h>
#include<conio.h>
void main(void)
{
int kelvin,centigrade,fahrenheit;
printf("temperature in kelvin\n");
scanf("%d",&kelvin);
centigrade=kelvin-273;
printf("temperature in centigrade is\n%d,degree centigrades ",centigrade);
fahrenheit=(centigrade*9/5)+32;
printf("\ntemperature in fahrenheit is\n%d,degree fahrenheits ",fahrenheit);
getch();
}
in two weeks of learning c. ihave wrote the following programs
#include<stdio.h>
#include<math.h>
#include<conio.h>
void main(void)
{
int a_int,b_int,c_int,root1_int,root2_int;
printf("The Quadratic Equation\na*x*x+b*x+c=0\n");
printf("Value Of a_int\n");
scanf("%d",&a_int);
printf("Value Of b_int\n");
scanf("%d",&b_int);
printf("Value Of c_int");
scanf("%d",&c_int);
root1_int=(-b_int+sqrt(b_int*b_int-4*a_int*c_int))/(2*a_int);
printf("root1_int is%d\n",root1_int);
root2_int=-(b_int-sqrt(b_int*b_int-4*a_int*c_int))/(2*a_int);
printf("root2_int is%d\n",root2_int);
getche();
}
2
#include<stdio.h>
#include<conio.h>
void main(void)
{
int radius,volume,area;
printf("finding area and volume of a sphere);
printf("give the radius of sphere\n");
scanf("%d",&radius);
volume=(4/3)*3.14*radius*radius*radius;
printf("Volume Of Sphere is\n%d",volume);
area=4*3.14*radius*radius;
printf("\nArea Of Sphere is\n%d",area);
}
and some others
thanks for ur support now iam writing aprogramm which can find factorial but it is not working
#include<stdio.h>
void main(void)
{
int i,j,s,f,n;
printf("value of num");
scanf("%D",&n);
s=0;
{
for(i=1,i<=n,n++);
{
for(j=i,j>=1,j--);
}
s=i/f+s;
f=i;
}
printf("sum=%d"sum);
}
I am learning from book of Robert Lafore(Cprogramming Using Turbo C++)
hello guys
i am new in this forum and in programing
i want to write a program which could convert given temperature and its unit into oher scales please give me some sugestions and ideas bout that
and i need to know how to declear chareters and how to take inputs of characters
Looking forward for yopur help
thanks
saqib.