السلام عليكم.. (الظاهر تم مسح موضوعي لانه تكرر والمشكله من الconnection :shy: )
المهم..
برمجت هذا البرنامج بال C++.. واهوا يقوم يتحويل عمر الشخص من رقم الى binary
كود:
//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\//
// Program that Convert Decimal integer to a binary recursively\/\/
//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\//
#include <iostream>
using namespace std;
void decToBin( int, int );
int main()
{
// Creating a variable of type integer
int decimal;
// message to the user to input his age
cout << "Enter your age, to convert it to binary: ";
cin >> decimal; // save it to the varible
cout << "\nYour age in Binary is: ";
decToBin( decimal, 2 ); // calling the function to convert to binary
cout << endl; // output a newline
return 0; // To indicate Successfully termination
} // end main
// a recursive function to find the binary of an integer
void decToBin(int num, int base)
{
if (num > 0)
{
decToBin(num/base, base);
cout<< num % base;
}
} // end function decToBin
أتمنى اذا احد يقدر يكتبله لي بال PHP اكون له شاكر
*ملاحظه: اتمنى يكون مبسط وسهل.. عشان اقدر اركبه قالب واستايل..* والف شكر