السلام عليكم و رحمة الله و بركاته
انا سويت برنامج لحساب المعدل التراكمي لطلاب الثانوية
بس المشكلة انا لما ابغى اعرض ما يحتويه الفكتور و هي اسماء المواد يوقف البرنامج
ولما عملت debug طلع لي هذا الخطأ
---------------------------
Microsoft Visual C++
---------------------------
Unhandled exception in test.exe: 0xC0000005: Access Violation.
---------------------------
OK
---------------------------
و الخطا هذا يطلع عندما يوصل المؤشر حق ال debug الى مكان ما هو مكتوب في الكود "هنا المشكلة"
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
using namespace std;
int main()
{
double degree[18];
string names[18];
names[0]="Quran";
names[1]="To7id";
names[2]="7HDITH";
names[3]="Feqh";
names[4]="Tafser";
names[5]="Na7ow";
names[6]="Adab";
names[7]="English";
names[8]="Math";
names[9]="Phys";
names[10]="Chems";
names[11]="Biology A7iya'a";
names[12]="Gelogy";
names[13]="Computer";
names[14]="Sprot";
names[15]="Wataniha";
names[16]="Moadabh";
names[17]="Selock";
double hours[17];
/* hours[0]=1.0;
hours[1]=1.0;
hours[2]=1.0;
hours[3]=1.0;
hours[4]=1.0;
hours[5]=2.0;
hours[6]=1.0;
hours[7]=4.0;
hours[8]=6.0;
hours[9]=4.0;
hours[10]=4.0;
hours[11]=4.0;
hours[12]=1.0;
hours[13]=2.0;
hours[14]=1.0;
hours[15]=1.0;
hours[16]=1.0;
hours[17]=1.0;*/
cout << "The full grade is each subjct is = ";
double full_g;
cin >> full_g;
// cout <<"Grades \n";
double sum_full=0.0; double sum_part=0.0;
double degree_full=0.0; double degree_part=0.0;
cout << "Put the degres infront each subject \n";
bool more=true;
while(more)
{
for(int i=0;i<18;i++)
{
cout << "Put the dgree for this subject "<<setw(4);
cout << names<<" ";
cin >> degree;
cout << "Type noumber of HESSAS in a week ";
cin >> hours;
cout << "\n";
}
for(int q=0;q<18;q++)////////////////هنا المشكلة
{
cout << names[q] << setw(5) << degree[q];
}
cout << "R u sure from these dgrees? (Y/N) ";
string answer;
cin >> answer;
if(answer=="Y"||answer=="y")
{
more=false;
}
else more=true;
}
for(int j=0;j<18;j++)
{
sum_full=sum_full+(degree[j]*hours[j]);
degree_full=degree_full+(50*hours[j]);
sum_part=sum_part+degree[j];
degree_part=degree_part+50;
}
double result_full=(sum_full/degree_full)*100.0;
double result_part=(sum_part/degree_part)*100.0;
cout << "\n" << "ur % in system 'TARAKOME' is = "<< result_full << " % \n";
cout << "ur % in normal system is = " << result_part<< " % \n";
system("pause");
return 0;
}ارجو الافادة
و السلام عليكم و رحمة الله و بركاته


