برنامه نویسی به زبان ++C
مسئله ی برج های هانوی
برای دریافت اطلاعات بیشتر در مورد برج های هانوی کلیک کنید.
#include
#include
using namespace std; void hanoy(int n,char start,char m,char fin); int main() { int n; cout<<"From A to C"<
>n; hanoy(n,'a','b','c'); } void hanoy(int n,char start,char temp,char fin) { if(n==1) { cout<
+
نوشته شده در پنجشنبه بیست و نهم فروردین ۱۳۹۲ ساعت 16:23 توسط Mohammad Tabeemam |
مرتب کردن اسامی بر اساس حروف انگلیسی
#include
#include
#include
#include
using namespace std; void sleep(long wait) { clock_t start = clock(); while (clock() - start < wait); } int main() { int n; system("color 72"); cout<<"How many names do you want to enter?"; cin>>n; cout<<"Enter Names:"<
>name[i]; for(int i=n-1; i>0; i--) { int a=0; for(int j=0; j
(int)name[j+1].at(a)) swap(name[j],name[j+1]); else if((int)name[j].at(a)==(int)name[j+1].at(a)) { a++; goto check; } } } cout<<"_________________________________________________\n"; for(int i=0; i
+
نوشته شده در چهارشنبه بیست و هشتم فروردین ۱۳۹۲ ساعت 0:5 توسط Mohammad Tabeemam |
بازی هنگ من
#include
#include
#include
#include
#include
using namespace std; void sleep(long wait) { clock_t start = clock(); while (clock() - start < wait); } int main() { char d; again: { system("cls"); system("COLOR 3"); cout <
>number_characters_player_chooses; int number_of_the_word; srand(time(0)); number_of_the_word = (rand()%(10)); string the_word; if(number_characters_player_chooses ==3) the_word = words1[number_of_the_word]; else if(number_characters_player_chooses == 7) the_word = words2[number_of_the_word]; else if(number_characters_player_chooses == 10) the_word = words3[number_of_the_word]; else the_word = words4[number_of_the_word]; system("CLS"); string guess_marks_saver[number_characters_player_chooses]; int counter =0; for(; number_characters_player_chooses >0; number_characters_player_chooses--) { guess_marks_saver[counter] ="-"; counter++; } int number_of_chances = counter ; system("COLOR 3"); for(; number_of_chances >0; number_of_chances--) { int counter1 =0; string guess; string if_guess; int guess_character_browser =0; cout <<" "; for(; counter1
>guess; for(; guess_character_browser
>d; if(d=='y'||'Y') goto again; } } int counter3 =0; string character; for(; counter3
>d; if(d=='y'||'Y') goto again; } } system("CLS"); counter3 =0; } cout <
>d; if(d=='y'||'Y') goto again; return 0; }
برچسبها:
بازی
,
هنگ من
,
حدس
,
کلمه
+
نوشته شده در دوشنبه بیست و ششم فروردین ۱۳۹۲ ساعت 22:6 توسط Mohammad Tabeemam |
کد حدس عدد بین 1 تا 50
#include
#include
// for srand() and rand() #include
// for time(NULL) in srand() #include
using namespace std; int main() { char d; int max_num = 50; int max_tries = 5; int random_number; int guess = 0; int current_tries = 0; int low_guess = 1; int high_guess = max_num; again: { srand(time(NULL)); random_number = rand() % 50+1; while(current_tries < max_tries) { cout << max_tries-current_tries << " Chances Remained:"<
> guess; if(guess == random_number) { cout << "Congratulations! You guessed correctly!" << endl; break; } if(guess > random_number) { cout << "Lower!!" << endl; } if(guess < random_number) { cout << "Higher!!" << endl; } current_tries++; if(current_tries >= max_tries) { cout << "You Lose. The number was " << random_number << endl; break; } } } current_tries=0; cout<<"Again?(Y or N)"; cin>>d; switch(d) { case 'y': case 'Y': system("cls"); goto again; break; case 'n': case 'N': break; } return 0; }
برچسبها:
بازی
,
حدس عدد
,
بازی حدس عدد
+
نوشته شده در یکشنبه بیست و پنجم فروردین ۱۳۹۲ ساعت 23:59 توسط Mohammad Tabeemam |
تبدیل واحد های طول
تبدیل واحد طول(اینچ،فوت،مایل،یارد،متر)
#include
#include
using namespace std; int main() { cout<<"Inch: 1 // Foot: 2 // Yard: 3 // Mile: 4 // Meter: 5"<
>a; cout<<"TO"<
>b; cout<<"Number"<
>n; if(a==1) { if(b==2) cout<
برچسبها:
تبدیل واحد
,
طول
,
تبدیل
,
متر
+
نوشته شده در یکشنبه بیست و پنجم فروردین ۱۳۹۲ ساعت 13:20 توسط Mohammad Tabeemam |
روز های هفته
چاپ روز های هفته با عدد دریافتی از کاربر
#include
using namespace std; int main() { int n; cin>>n; switch(n) { case 1: cout<<"Shanbe"; break; case 2: cout<<"Yek Shanbe"; break; case 3: cout<<"Do Shanbe"; break; case 4: cout<<"Se Shanbe"; break; case 5: cout<<"ChaharShanbe"; break; case 6: cout<<"Panj Shanbe"; break; case 7: cout<<"Jome"; break; } return 0; }
برچسبها:
روزهای هفته
,
هفته
,
روز
+
نوشته شده در یکشنبه بیست و پنجم فروردین ۱۳۹۲ ساعت 11:34 توسط Mohammad Tabeemam |
خانه
پروفایل مدیر وبلاگ
پست الکترونیک
آرشیو وبلاگ
عناوین نوشته ها
نوشتههای پیشین
هفته چهارم بهمن ۱۳۹۵
هفته دوم بهمن ۱۳۹۵
هفته سوم خرداد ۱۳۹۲
هفته دوم خرداد ۱۳۹۲
هفته اوّل خرداد ۱۳۹۲
هفته چهارم اردیبهشت ۱۳۹۲
هفته اوّل اردیبهشت ۱۳۹۲
هفته چهارم فروردین ۱۳۹۲
هفته سوم فروردین ۱۳۹۲
هفته دوم فروردین ۱۳۹۲
هفته اوّل فروردین ۱۳۹۲
هفته چهارم اسفند ۱۳۹۱
هفته سوم اسفند ۱۳۹۱
آرشیو موضوعی
ساده و مبتدیانه
متوسط و معمولی
پیشرفته(گرافیکی)
برچسبها
C
(3)
Programming
(3)
برنامه نویسی
(3)
سی پلاس پلاس
(3)
بازی
(2)
ستاره
(1)
متر
(1)
تایمر
(1)
تبدیل
(1)
اینچ
(1)
اشکال
(1)
CPP
(1)
هندسی
(1)
تبدیل واحد
(1)
کرنومتر
(1)
حدس عدد
(1)
بازی حدس عدد
(1)
هنگ من
(1)
کرنومتر و تایمر
(1)
کدر c
(1)
نویسندگان
Mohammad Tabeemam
Amir Navid
Mohsen Eslamian
BLOGFA.COM