Results 1 to 1 of 1
I know this is an easy and straight forward algorithm and code... but I'm quite useless with Bash and putty.
I've done the code just not in .sh format
Code:
...
- 04-18-2011 #1Just Joined!
- Join Date
- Feb 2010
- Posts
- 3
Turn to BASH
I know this is an easy and straight forward algorithm and code... but I'm quite useless with Bash and putty.
I've done the code just not in .sh format
Basically I need to make this code run in putty as a .sh file ... and I rarely use this putty thing so my skills there are extremely limited... help would be appreciated .Code:#include<stdio.h> void main() { char p[10][5]; int tot=0,wt[10],i,n; float avg=0; clrscr(); printf("enter no of processes:"); scanf("%d",&n); for(i=0;i<n;i++) { printf("enter process%d name:\n",i+1); scanf("%s",&p[i]); printf("enter process time"); scanf("%d",&pt[i]); } wt[0]=0; for(i=1;i<n;i++) { wt[i]=wt[i-1]+et[i-1]; tot=tot+wt[i]; } avg=(float)tot/n; printf("p_name\t P_time\t w_time\n"); for(i=0;i<n;i++) printf("%s\t%d\t%d\n",p[i],et[i],wt[i]); printf("total waiting time=%d\n avg waiting time=%f",tot,avg); getch(); }


Reply With Quote