Warning: Declaration of Bootstrap_Walker::start_lvl(&$output, $depth) should be compatible with Walker_Nav_Menu::start_lvl(&$output, $depth = 0, $args = NULL) in /home/itport/public_html/wp-content/themes/itport-v5.0/functions/bootstrap-walker.php on line 25

Warning: Declaration of Bootstrap_Walker::end_lvl(&$output, $depth) should be compatible with Walker_Nav_Menu::end_lvl(&$output, $depth = 0, $args = NULL) in /home/itport/public_html/wp-content/themes/itport-v5.0/functions/bootstrap-walker.php on line 42

Warning: Declaration of Bootstrap_Walker::start_el(&$output, $item, $depth, $args) should be compatible with Walker_Nav_Menu::start_el(&$output, $data_object, $depth = 0, $args = NULL, $current_object_id = 0) in /home/itport/public_html/wp-content/themes/itport-v5.0/functions/bootstrap-walker.php on line 57

Warning: Declaration of Bootstrap_Walker::end_el(&$output, $item, $depth, $args) should be compatible with Walker_Nav_Menu::end_el(&$output, $data_object, $depth = 0, $args = NULL) in /home/itport/public_html/wp-content/themes/itport-v5.0/functions/bootstrap-walker.php on line 108
آی تی پورت | آموزش برنامه نویسی (حل تمرین 1)
Warning: Use of undefined constant url - assumed 'url' (this will throw an Error in a future version of PHP) in /home/itport/public_html/wp-content/themes/itport-v5.0/header.php on line 56

Warning: Use of undefined constant title - assumed 'title' (this will throw an Error in a future version of PHP) in /home/itport/public_html/wp-content/themes/itport-v5.0/header.php on line 57
برنامه نویسیسی پلاس پلاس

آموزش برنامه نویسی (حل تمرین ۱)

آموزش برنامه نویسی - آی تی پورت

با توجه به درخواست برخی از دوستان برای آموزش بهتر برنامه نویسی ++C ما تصمیم گرفتیم علاوه بر فایل های آموزش مثال های بیشتری به شما ارائه دهیم از همین رو بخش حل تمرین ++C رو راه انداختیم ، امیدوارم این تمرین ها نیاز های شما دوستان را بر طرف کند. اگر نیاز به جواب خاصی برای تمرینی بودید فقط کافیست صورت مسئله را به ما بدهید تا در سری بعد جواب آن را به شما بدهیم و اگر قستی از برنامه برای شما نا مفهمو بود از قسمت دیدگاه استفاه کنید و از ما بپرسید تا توضیح کامل داده شود.

تمرین شماره ۱ :

برنامه بنویسید که جدول کدهای اسکی را نمایش دهد.

#include <iostream.h>



int main()

{

  for(char ch=-128;ch<127;ch++)

    cout<<"character="<<ch

         <<"\tASCII Code="<<(int)ch<<"\n";

  cout<<"character="<<ch<<"\tASCII Code="<<(int)ch<<endl;

  return 0 ;

}

 تمرین شماره ۲ :

تابعی بنویسید که جستجو دودویی یا باینری را پیاده سازی کند.

int binarySearch(int arr[], int len, int pat)

{

    int mid, low=0, high=len-1;

    while(low<=high)

    {

        mid=(low+high)/2;

        if(pat<arr[mid])

            high=mid-1;

        else if(pat>arr[mid])

            low=mid+1;

        else

            return mid;

    }

    return -1;

}

تمرین شماره ۳ :

تابع مرتب سازی حبابی را بنویسید.

void BubbleSort(int temp[], int len)

{

    int i, j, item;

    for(i=len-1;i>0;i--)

        for(j=0;j<i;j++)

            if(temp[j]>temp[j+1])

            {

                item=temp[j];

                temp[j]=temp[j+1];

                temp[j+1]=item;

            }

}

تمرین شماره ۴ :

تابع مرتب سازی انتخابی را بنویسید.

void selectionSort(int arr[], int len)

{

     int i, j, minIndex, tmp;

     for (i = 0; i < len - 1; i++)

    {

         minIndex = i;

          for (j = i + 1; j < len; j++)

                if (arr[j] < arr[minIndex])

                     minIndex = j;

        if (minIndex != i)

        {

                tmp = arr[i];

            arr[i] = arr[minIndex];

                arr[minIndex] = tmp;



        }



    }



}

 

گفتگو ها
    نسترن

    ممنون جالب بود

    من چند سوال دارم برای شما ایمیل می کنم لطفا جواب ها رو به ایمیلم بفرستید.

    samira

    سلام.خیلی ممنون از زحماتتون.بسیار مفید و عالی بود!

    سمانه

    باسلام من رشته تصیلی ام نرم افزار کامپیوتر هست که سال ۸۷ تمام شده و فاصله بین رشته و شغلم پیش اومده لطف میکنیدلطفا برای آموزش کامل و تسلط بر زبان برنامه نویسی ++C و ارسال فایلهای آموزشی به ایمیلم منو کمک و راهنمایی نمایید.برای علاقه وپیشرفت شغلی نیازبه این آموزش دارم.

    با تشکر