الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

مشكله مهمه في البرنامج احتاج مساعده ضروري

بدأه charmed girl في 6 مايو 2014 · 1 رد · 798 مشاهدة · في ارشيف قسم C/C++
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم 

انا مبتدءه في مجال البرمجه ومحتاجه ضروري اعمل عده برامج وبالفعل بدءت وعملت برنامج round robin

والبرنامج فعلا الحمد لله بدء يعمل run بس للاسف اول ما يبدء يحسب الاجابه البرنامج بيقفل 
ده الكود وارجو ان حد يفيدني ويعرفني هو الغلط فين لان دي اول مره اتعامل مع c++ 

ويقولي هو بقفل ليه 

الله يخليكم محتاجه الاجابه في اسرع وقت ممكن وجزاكم الله كل الخير

// Round robin test final.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <iostream># include <stdio.h> # include <conio.h>#include <string.h>#include <iomanip>#include <ctime>#include <cmath>#include <fstream>#include <windows.h>#include <sstream># include<stdlib.h>#include <limits>#include <list>#define cls system("cls")#define frz system("pause");#define yl  system("color 0e");using namespace std;using std::cout;using std::cin;using std::endl;using std::string;using std::streamsize;using std::setprecision;int restime;class cpuschedule{int t[10], tat[10], n, Bu[20], Buo[10], at[10], nwj, ft[10];float Twt, Awt, atat, ttat, A[10], Wt[10], w, ard, trd, trbyts[10];public://Getting the No of processes & burst timevoid Getdata();//Round Robin Algorithmvoid RoundRobin();};void cpuschedule::Getdata(){int i;cout << "Enter the no of processes:" << endl;cin >> n;nwj = n;for (i = 1; i <= n; i++){cout << endl << "Enter The BurstTime for Process p" << i << "= ";cin >> Bu;t = i;cout << endl << "Enter The arrivalTime for Process p" << i << "= ";cin >> at;}for (int v = 1; v <= n; v++){for (int p = v + 1; p <= n; p++){if (at[v]>at[p]){int temp = at[v];at[v] = at[p];at[p] = temp;int temp1 = Bu[v];Bu[v] = Bu[p];Bu[p] = temp1;int temp2 = t[v];t[v] = t[p];t[p] = temp2;}}Buo[v] = Bu[v];}}//Round Robin Algorithm//void cpuschedule::RoundRobin(){int i, j, tq, k, B[10], Rrobin[10][10], count[10];int max = 0;int m;Twt = 0.0;for (i = 1; i <= n; i++){B = Bu;if (max<B)max = B;Wt = 0;}cout << endl << "Enter the Time Quantum=";cin >> tq;while (tq <= 0){cout << "invalid time :\n";cout << endl << "Enter the Time Quantum=";cin >> tq;}//TO find the dimension of the Rrobin arrayif (max%tq == 0)m = max / tq;elsem = max / tq + 1;restime = at[1];while (nwj){for (int l = 1; l <= n; l++){if (!Bu[l])continue;if (Bu[l] <= tq){restime += Bu[l];ft[l] = restime;Bu[l] = 0;nwj--;}else{Bu[l] -= tq;restime += tq;}}}for (i = 1; i <= n; i++){tat = ft - at;trbyts = float(tat) / Buo;}//calculating weighting timefor (int a = 1; a <= n; a++){Wt[a] = ft[a] - Buo[a] - at[a];}cout << "------------------------------------------------------ " << endl;cout << endl << "process\tat\tst\twt\tft\ttat\ttrbyts" << endl;cout << "------------------------------------------------------ " << endl;ttat = 0.0;trd = 0.0;for (int g = 1; g <= n; g++){trbyts[g] = float(tat[g]) / Buo[g];cout << "p->" << t[g] << "\t" << at[g] << "\t" << Buo[g] << "\t" << Wt[g] << "\t" << ft[g] << "\t" << tat[g] << "\t" << trbyts[g] << endl;ttat += tat[g];trd += trbyts[g];}atat = float(ttat) / n;ard = float(trd) / n;//calculating Average Weighting Timefor (i = 1; i <= n; i++)Twt = Twt + Wt;Awt = Twt / n;cout << endl << "Total   Weighting Time=" << Twt;cout << endl << "Average Weighting Time=" << Awt << "";cout << endl << "Average turn arround Time=" << atat << "";cout << endl << "Average response Time=" << ard << "";}void main(){cpuschedule c;system("cls");cout << "ROUND ROBIN SCHEDULING:" << endl;c.Getdata();c.RoundRobin();std::cin.get();}

تم تعديل هذه المشاركة بواسطة مصطفى 36a2 في 14 مايو 2014 في 15:10

1 −1
#2

المشكلة ليست من الكود

 

فى visual studio من القائمة Debug اختر Start without debugging او اضغط Ctrl+F5


﴿وَمَا كَانَ اللَّهُ لِيُعَذِّبَهُمْ وَأَنْتَ فِيهِمْ ۚ وَمَا كَانَ اللَّهُ مُعَذِّبَهُمْ وَهُمْ يَسْتَغْفِرُونَ﴾

الأنفال ۳۳                                  
 

مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…