3 Replies - 7683 Views - Last Post: 06 October 2012 - 10:35 AM Rate Topic: -----

#1 megurine  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 05-October 12

Fcfs scheduling in C++

Posted 05 October 2012 - 08:22 PM

hi..i have this code here which compute first come first serve cpusheduling in c++,,but for some reasons,its not working,,i dont know if the problem was the language im using,,i used visual studio2005,C++,then win32 console application i dont know if its right..pls help.

i always get this error :1>d:\osfcfs\cpufcfs\cpufcfs\cpufcfs.h(5) : fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory



[ #include<iostream.h>
#include<conio.h>
#include<stdio.h>

class cpufcfs
{
	int n,Bu[20];
	float Twt,Awt,A[10],Wt[10],w;

public:


	void Getdata();
	
	void Fcfs();

};

void cpuschedule::Getdata()
{
	int i;
	cout<<"
Enter the no of processes:";
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cout<<"
Enter The BurstTime for Process p"<<i<<"=	";
		cin>>Bu[i];
	}
}

void cpuschedule::Fcfs()
{
	int i,B[10];
	Twt=0.0;
	for(i=1;i<=n;i++)
	{
		B[i]=Bu[i];
		cout<<"
Burst time for process p"<<i<<"=	";
		cout<<B[i];
	}
	Wt[1]=0;
	for(i=2;i<=n;i++)
	{
		Wt[i]=B[i-1]+Wt[i-1];
	}

	//Calculating Average Weighting Time
	for(i=1;i<=n;i++)
		Twt=Twt+Wt[i];
	Awt=Twt/n;
	cout<<"
Total   Weighting Time="<<Twt;
	cout<<"
Average Weighting Time="<<Awt<<"
";
}


]

Is This A Good Question/Topic? 0
  • +

Replies To: Fcfs scheduling in C++

#2 Salem_c  Icon User is offline

  • void main'ers are DOOMED
  • member icon

Reputation: 1678
  • View blog
  • Posts: 3,180
  • Joined: 30-May 10

Re: Fcfs scheduling in C++

Posted 05 October 2012 - 09:27 PM

How about doing your own homework, instead of just downloading any random crap you find on the web.
http://cplusplus.hap...hms/code37.html

> fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory
Do you know that obsolete C++ uses
#include <iostream.h>

and modern C++ uses
#include <iostream>
using namespace std;


When you've got it to compile, then you've got the fun times of debugging that PoS you copied from.
Was This Post Helpful? 1
  • +
  • -

#3 megurine  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 05-October 12

Re: Fcfs scheduling in C++

Posted 05 October 2012 - 10:50 PM

ok im sorry for what ive done,,i tried to make my own..but i dont know if its right,,sorry
Was This Post Helpful? 0
  • +
  • -

#4 Salem_c  Icon User is offline

  • void main'ers are DOOMED
  • member icon

Reputation: 1678
  • View blog
  • Posts: 3,180
  • Joined: 30-May 10

Re: Fcfs scheduling in C++

Posted 06 October 2012 - 10:35 AM

> ,i tried to make my own..but i dont know if its right,,sorry
And how would you know that some random code downloaded from the internet worked?
Or was it just a matter of faith because it had enough words in it which sounded impressive.

You check that it works by writing a test.

So for example, if you give your scheduler 3 processes to work on, you should be able to predict in advance what you're expecting to see. If you see something different, then you need to ask
- was my prediction wrong
- is the code wrong
Figuring out which side of the keyboard the bug is on is all part of learning how to write software.

This shows you what your results should look like.
http://siber.cankaya...28/node122.html
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1