قناة سكاو في الواتساب
 


حسابنا في السناب شاتحسابنا في منصة Xقناتنا في اليوتيوبحسابنا في التيك توكقناتنا في التيليجرامقناة سكاو في الواتساب
 
وصف

العودة   منتديات سكاو > الكليات الجامعية > منتدى كلية الحاسبات وتقنية المعلومات > منتدى قسم تقنية المعلومات
التسجيل مشاركات اليوم البحث
   
   


كيف اشغل ملف بلغة ال c++

منتدى قسم تقنية المعلومات

 
 
أدوات الموضوع إبحث في الموضوع انواع عرض الموضوع
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 19-10-2010, 06:22 AM   #4

Mr.Ahmad

عضو هيئة تدريس

الصورة الرمزية Mr.Ahmad

 
تاريخ التسجيل: Jul 2008
كلية: كلية الحاسبات وتقنية المعلومات
التخصص: IT
نوع الدراسة: عضو هيئة تدريس
المستوى: متخرج
البلد: جــــدة
الجنس: ذكر
المشاركات: 2,477
افتراضي رد: كيف اشغل ملف بلغة ال c++

نعم ,, للاسف , بعض بيئات التطوير لا تلتزم بالشكل القياسي لكتابة اللغة , فتجد مثلاً الكود السابق ربما يشتغل على dev C++ بدون مشاكل أو برنامج آخر ...

عموماً ,,, تعديل الكود ليعمل على الفجوال ستديو :
كود PHP:

//-------------------------------------------------------------------------------
#include <iostream>
#include <conio.h>
#include <time.h>
#include <vector>

using namespace std;

double diffclock(clock_t clock1,clock_t clock2);

//--------------------------------------------------------------------------------
int main()
{
//clrscr();
system("CLS") ;
//--------------------------------------------------------------------------------

int size 0//size of the matrix.
int BlockSize 0;
clock_t end,begin;
int m;
char a;
//--------------------------------------------------------------------------------
//Compiler directive to increase the buffer and memory size
std::vector<std::vector<int> > A(1000std::vector<int>(1000));
std::vector<std::vector<int> > B(1000std::vector<int>(1000));
std::vector<std::vector<int> > C(1000std::vector<int>(1000));

//--------------------------------------------------------------------------------
//ask the user about multiplication method.
do{
   
//clrscr();
    
system("CLS") ;

   
cout << "\n\t ------------------------------------------------------";
   
cout << "\n\t  ````````````````` Welcome ``````````````````     ";
   
cout << "\n\t  ``````  Matrix Multiplication Program ``````     ";
   
cout << "\n\t ------------------------------------------------------";

cout << "\n Enter the size of the Matrix : ";
cin >> size;

cout << "\n\n Choose the Matrix Multiplication Method:\n";
cout << "  1. Row by Column.\n";
cout << "  2. Row by Row.\n";
cout << "  3. Column by Column.\n";
cout << "  4. Block Matrix (Row by Column).\n";
cout << "  5. Block Matrix (Row by Row).\n";
cout << "  6. Block Matrix (Column by Column).\n\n";
cout << "  ";
cin >> m;

//-------------------------------------------------------------------------------
//initilize the matrix.

for(int i size i++)
{
 for(
int j size j++)
 {
  
A[i][j]= 1;
  
B[i][j]=1;
  
C[i][j]=0;
 }
}

//--------------------------------------------------------------------------------
if(== 1){
//Multiply the matrix B by matrix C Row by column (regular).
begin clock();
for(
int i size i++)
     for(
int j size j++)
        for(
int k ;size k++)
           
A[i][j] += B[i][k]* C[k][j];
end clock();
//--------------------------------------------------------------------------------
//display the result.
cout << "\n\n The (Row by column) Multiplication result :\n\n";

cout<<"\n\n The Execution Time: "<<diffclock(end,begin)<<" ms."<<endl;
}
//--------------------------------------------------------------------------------
else if(== 2){
//Multiply the matrix B by matrix C Row by Row.
begin clock();
for(
int i size i++)
     for(
int j size j++)
        for(
int k ;size k++)
           
A[i][k] += B[i][j]* C[j][k];
end clock();
//--------------------------------------------------------------------------------
//display the result.
cout << "\n\n The (Row by Row) Multiplication result :\n\n";

cout<<"\n\n The Execution Time: "<<diffclock(end,begin)<<" ms."<<endl;
}
//--------------------------------------------------------------------------------
else if(== 3){
//Multiply the matrix B by matrix C column by column.
begin clock();
for(
int i size i++)
     for(
int j size j++)
        for(
int k ;size k++)
           
A[k][i] += B[k][j]* C[j][i];
end clock();
//--------------------------------------------------------------------------------
//display the result.
cout << "\n\n The (column by column) Multiplication result :\n\n";

cout<<"\n\n The Execution Time: "<<diffclock(end,begin)<<" ms."<<endl;
}
//--------------------------------------------------------------------------------
else if(== 4){
//Multiply the Block matrix B by Block matrix C Row by Column.
cout<< "\n Enter the Block Size : ";
cin>> BlockSize;

while(
BlockSize size)
{
cout <<"\n You must enter the block size less than the size!";
 
cout<< "\n Enter the Block Size : ";
 
cin>>BlockSize;
 }

while(
size BlockSize != 0)
{
cout <<"\n You must enter the block size divisible by the size!";
 
cout<< "\n Enter the Block Size : ";
 
cin>>BlockSize;
}

begin clock();

for (
int i1 0i1 size i1+=BlockSize)

                for (
int j1 0j1 size j1 += BlockSize)

                    for (
int k1 0k1 size k1 += BlockSize)

                        for (
int i i1i1 BlockSize && size i++)

                            for (
int j j1<j1 BlockSize && j<sizej++)

                                for (
int k k1k1 BlockSize && sizek++)

                                    
A[i][j] += B[i][k]* C[k][j];
end clock();
//--------------------------------------------------------------------------------
//display the result.
cout << "\n\n The Block Matrix(Row by Column) Multiplication result :\n\n";

cout<<"\n\n The Execution Time: "<<diffclock(end,begin)<<" ms."<<endl;
}
//--------------------------------------------------------------------------------
else if(== 5){
//Multiply the Block matrix B by Block matrix C Row by Row.
cout<< "\n Enter the Block Size : ";
cin>> BlockSize;

while(
BlockSize size)
{
cout <<"\n You must enter the block size less than the size!";
 
cout<< "\n Enter the Block Size : ";
 
cin>>BlockSize;
 }

while(
size BlockSize != 0)
{
cout <<"\n You must enter the block size divisible by the size!";
 
cout<< "\n Enter the Block Size : ";
 
cin>>BlockSize;
}

begin clock();

for (
int i1 0i1 size i1+=BlockSize)

                for (
int j1 0j1 size j1 += BlockSize)

                    for (
int k1 0k1 size k1 += BlockSize)

                        for (
int i i1i1 BlockSize && size i++)

                            for (
int j j1<j1 BlockSize && j<sizej++)

                                for (
int k k1k1 BlockSize && sizek++)

                                    
A[i][k] += B[i][j]* C[j][k];
end clock();
//--------------------------------------------------------------------------------
//display the result.
cout << "\n\n The Block Matrix(Row by Row) Multiplication result :\n\n";

cout<<"\n\n The Execution Time: "<<diffclock(end,begin)<<" ms."<<endl;
}
//--------------------------------------------------------------------------------
else if(== 6){
//Multiply the Block matrix B by Block matrix C Col by Col.
cout<< "\n Enter the Block Size : ";
cin>> BlockSize;

while(
BlockSize size)
{
cout <<"\n You must enter the block size less than the size!";
 
cout<< "\n Enter the Block Size : ";
 
cin>>BlockSize;
 }

 while(
size BlockSize != 0)
{
cout <<"\n You must enter the block size divisible by the size!";
 
cout<< "\n Enter the Block Size : ";
 
cin>>BlockSize;
}

begin clock();

for (
int i1 0i1 size i1+=BlockSize)

                for (
int j1 0j1 size j1 += BlockSize)

                    for (
int k1 0k1 size k1 += BlockSize)

                        for (
int i i1i1 BlockSize && size i++)

                            for (
int j j1<j1 BlockSize && j<sizej++)

                                for (
int k k1k1 BlockSize && sizek++)

                                    
A[k][i] += B[k][j]* C[j][i];
end clock();
//--------------------------------------------------------------------------------
//display the result.
cout << "\n\n The Block Matrix(Column by Column) Multiplication result :\n\n";

cout<<"\n\n The Execution Time: "<<diffclock(end,begin)<<" ms."<<endl;
}
//--------------------------------------------------------------------------------
else {
cout << "\n Select the number from the list";
}
//--------------------------------------------------------------------------------
cout << "\n\n Do you want to try again (y/n): ";
   
cin >> a;

   if(
== 'n')
   return 
0;

   }while(
== 'y');

//end main.
//--------------------------------------------------------------------------------
double diffclock(clock_t clock1,clock_t clock2)
{
double diffticks=clock1-clock2;
double diffms=(diffticks)/(CLOCKS_PER_SEC/1000);
return 
diffms;

 

Mr.Ahmad غير متواجد حالياً   رد مع اقتباس
 

 


تعليمات المشاركة
لا تستطيع إضافة مواضيع جديدة
لا تستطيع الرد على المواضيع
لا تستطيع إرفاق ملفات
لا تستطيع تعديل مشاركاتك

BB code is متاحة
كود [IMG] متاحة
كود HTML معطلة

الانتقال السريع

 


الساعة الآن 01:51 PM


Powered by vBulletin® Version 3.8.9 Beta 3
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Ads Organizer 3.0.3 by Analytics - Distance Education

أن كل ما ينشر في المنتدى لا يمثل رأي الإدارة وانما يمثل رأي أصحابها

جميع الحقوق محفوظة لشبكة سكاو

2003-2025