#include<stdio.

h>
#include<conio.h>
#include<graphics.h>
main()
{ int gd=DETECT,gm;
float x1=250,y1=150,y2=350,gap,sec,A[100],B[100],C[100];
float sp,w,bm,sf,ma,ra,rb,i,k,x;
clrscr();
printf("values of span,udl\n");
scanf("%f%f",&sp,&w);
k=sp/0.05;
ra=5*w*sp/8;
rb=3*w*sp/8;
ma=-((-rb*sp)+w*sp*sp/2);
for(i=0;i<=k;i++)
{x=i*0.05;
bm=ma+ra*x-w*x*x/2;
sf=ra-w*x;
A[i]=x;
B[i]=sf;
C[i]=bm;
}
for(i=0;i<=k;i=i+5)
printf("\t%f\t%f\t%f\n",A[i],B[i],C[i]);
getch();
printf("\n\nEnter the x_scale for graphics....Ex: 2to5 or 5to10 =");
scanf("%f",&gap);
printf("\nEnter the y_scale for graphics....Ex:0.25to5 or 5to20 =");
scanf("%f",&sec);
printf("\n\n\n\t\t..................press any key for result");
getch();
initgraph(&gd,&gm," ");
setfillstyle(1,5);
floodfill(0,0,5);
setfillstyle(5,1);
settextstyle(2,HORIZ_DIR,5);
outtextxy(0,0," Span Shear
B.Moment");
for(i=0;i<=k;i=i+(sp*2))// text printing
{
printf("\n\n %1.2f %8.2f %8.2f ",A[i],B[i],C[i] );
}
rectangle(0,0,getmaxx(),getmaxy());
settextstyle(1,HORIZ_DIR,4);
outtextxy(250,50,"BMD DIAGRAM");
outtextxy(250,375,"SFD DIAGRAM");
for(i=0;i<=k*gap;i=i+gap)
{
bar(x1+i,y1-C[i/gap]*sec,x1+i+gap-1,y1);
bar(x1+i,y2-B[i/gap]*sec,x1+i+gap-1,y2);
}
getch();
closegraph();
}

Master your semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master your semester with Scribd & The New York Times

Cancel anytime.