| | |
pls fix this.....
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2008
Posts: 6
Reputation:
Solved Threads: 0
//challenge,, fix this!
C++ Syntax (Toggle Plain Text)
#include<stdio.h> #include<conio.h> void main() { struct job{ int at; int bt; }; struct job J[80], cpy[80], temp, cpy2[80]; int q, oh, jbn, x, y, z, t, ref=0, tt[80]; again: clrscr(); textcolor(YELLOW); gotoxy(20,5); cprintf("*** ROUND ROBIN WITH OVERHEAD ALGORITHM ***"); textcolor(10); gotoxy(5,7); cprintf("How many jobs do you want to enter?(max 15 jobs) "); scanf("%d", &jbn); if(jbn>15) { printf("\tThe maximum jobs that can be entered is 15. Please try again.\n"); printf("\tPress enter"); getch(); goto again;} else { gotoxy(10,9); printf("Please fill out the following arrival time and burst time"); gotoxy(15,11); printf("Job Arrival time Burst time"); y=11; for(x=1;x<=jbn;x++) {y=y+2; gotoxy(16,y);printf("J%d",x); gotoxy(33,y); scanf("%d",&J[x-1].at); gotoxy(54,y); scanf("%d",&J[x-1].bt);}//end for y=y+2; gotoxy(10,y); printf("Please enter the quantum time:\t"); scanf("%d",&q); y=y+2; gotoxy(10,y); printf("Please enter the overhead time:\t"); scanf("%d",&oh); y=y+2; gotoxy(10,y); puts("All the datas are inputted. Please press enter"); getch(); for(x=0;x<jbn;x++) {cpy[x].at=J[x].at; cpy[x].bt=J[x].bt;} for(x=jbn-1;x>=0;x--) {for(z=1;z<=x;z++) {if(cpy[x].at<cpy[x-z].at) {temp.at=cpy[x].at; temp.bt=cpy[x].bt; cpy[x].at=cpy[x-z].at; cpy[x].bt=cpy[x-z].bt; cpy[x-z].at=temp.at; cpy[x-z].bt=temp.bt;}//end if }//end for1 }//end for2 printf("\n"); for(x=0;x<jbn;x++) ref=ref+cpy[x].bt; for(x=0;x<jbn;x++) {cpy2[x].at=cpy[x].at; cpy2[x].bt=cpy[x].bt;} x=0; printf("Gantt Chart:\n\n"); for(t=0;t<=ref;t++) {printf("|"); z=0; while(cpy[x].at!=J[z].at&&cpy[x].bt!=J[z].bt) z++; printf(" J%d (%d)",z+1,J[z].bt); t=t+J[z].bt; tt[x]=t; t--; x++;} printf("|\n"); printf("Turnaround Time\n"); for(x=0;x<jbn;x++) {printf("tt = %d - %d",tt[x]+cpy[0].at, cpy[x].at); tt[x]=tt[x]-cpy[x].at+cpy[0].at; printf(" = %d\n",tt[x]);} printf("Waiting Time\n"); for(x=0;x<jbn;x++) {printf("wt = %d - %d",tt[x],cpy[x].bt); tt[x]=tt[x]-cpy[x].bt; printf(" = %d\n",tt[x]);} printf("%dcpy.at %dJ.at %dcpy2.at ",cpy[1].at,J[1].at,cpy2[1].at); printf("%dcpy.bat %dJ.bat %dcpy2.bat ",cpy[2].bt,J[1].bt,cpy2[1].bt); getch();}//end else }//end main
Last edited by Narue; Oct 4th, 2008 at 9:27 am. Reason: added code tags, no real help though with the crappy initial indentation
Yeah, the first challenge is for you to read the introduction threads, such as
and http://www.daniweb.com/forums/announcement8-3.html
•
•
•
•
Originally Posted by board intro
Our Software Development forum category encompasses topics related to application programming and software design. When posting programming code, encase it in [code], [code=syntax], where 'syntax' is any language found within our Code Snippets section, or [icode], for inline code, bbcode tags. Also, to keep DaniWeb a student-friendly place to learn, don't expect quick solutions to your homework. We'll help you get started and exchange algorithm ideas, but only if you show that you're willing to put in effort as well.
Our C++ forum is the place for Q&A-style discussions related to this popular language. Note we have a separate C forum for non-OOP straight C. Please direct C++ questions directly related to game development to our Game Development forum.
![]() |
Similar Threads
- Pls, help me to fix my PC! (Windows NT / 2000 / XP)
- tried all options - pls help (Viruses, Spyware and other Nasties)
- Pls help with my HJT log (Viruses, Spyware and other Nasties)
- help pls...Hjt log... (Viruses, Spyware and other Nasties)
- My Internet Browser is Hijacked! Pls Help. (Viruses, Spyware and other Nasties)
- can somebody pls. help me out with my HJT log.. (Viruses, Spyware and other Nasties)
Other Threads in the C++ Forum
- Previous Thread: Game of life in C++
- Next Thread: size of array
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll download dynamiccharacterarray email encryption error file forms fstream function functions game generator getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






