اذهب إلى المحتوى
  • 0

كتابة برنامج بلغة c++

نيلاي

السؤال

اتمنى تساعدوني بحلها

Write C++ Instruction for the followin

1.      Define integer variable with its name St-Name and value 5.

2.      Define one-dimensional Array with its name Courses and insert these String values (Math, Physics , Arabic).

3.      Constructor instruction for St-Name class.

رابط هذا التعليق
شارك على الشبكات الإجتماعية

Recommended Posts

  • 1
بتاريخ On 4/9/2020 at 02:44 قال Nadia الجهني:

اتمنى تساعدوني بحلها

Write C++ Instruction for the following

 

1.      Define integer variable with its name St-Name and value 5.

 

 

2.      Define one-dimensional Array with its name Courses and insert these String values (Math, Physics , Arabic).

 

 

3.      Constructor instruction for St-Name class.

 

السلام عليكم @Nadia الجهني
تفضلي قمت بعمله لك وقمت بوضع comments  توضح. اجزاء الكود ,ان احتجت شرح لاي جزء من الكود انا جاهز  :)  

#include <iostream>
using namespace std;

//constructor Class 
class courserc{
public:
   string courses[3] = {"Math", "Physics" , "Arabic"};
  
   
   courserc() {
      
    cout<<"Array elements are  as follows:"<<endl;
    
    
   }
};
int main()
{
    //make constructor object 
    courserc obj;
    
 
    
    for(int i=0;i<3;i++)
    {
        //use the obj;
         cout<<"Courses "<<i<<"= "<<obj.courses[i]<<endl;
       
    }
     
  return 0;  
}

تحياتي

شكرا لك

رابط هذا التعليق
شارك على الشبكات الإجتماعية

انضم إلى النقاش

يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.

زائر
أجب على هذا السؤال...

×   لقد أضفت محتوى بخط أو تنسيق مختلف.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   جرى استعادة المحتوى السابق..   امسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

  • إعلانات

  • تابعنا على



×
×
  • أضف...