بسم الله الرحمن الرحيم
كيفية برمجة صفحات الويب الديناميكية بالـ(C++)
أول شئ يمكن تقولون قدييييييييييييييييييييييييم لكن بالنسبة لي أنا بصراحة كنت ابحث عن هذا الشيء من زماااااااااااااااان وأخيرا عرفت
ماعلينا
أول شيء نكتب البرنامح بالـ(C++) زي أي برنامج عادي
//simple program
#include <iostream.h>
int main(int argc,char *argv[])
{
cout<<"hello world";
}ولكن فيه شئ بسييييييييييييط يختلف وهو انك تكتب الـ(Content-type) بتاع الصفحة
ألا وهو كالتالي:
//simple program
#include <iostream.h>
int main(int argc,char *argv[])
{
cout<<"Content-type: text/html"<<"hello world"; //don’t forget that "content-type"
return 0;
}اكيد تكتب الـ(HTML tags) بالـ(cout<<"";) أو بالـ(printf("");)
مثال
#include <iostream.h>
int main(int argc,char *argv[])
{
cout<<"Content-type: text/html";
char page[] = "
<html>
<head>
<title> C++ Web Application </title>
</head>
<body>
<b> this page wrote by C++</b>
</body>
</html> ";
cout<<page;
return 0;
}مثل ماتشوفون حفظنا الصفحة كاملة في المتغيير page[] واكيد هذي الطريقة ماهي الطريقة المثالية بل تستيع انشائها بالـclasses أو الماكروات
char page[] = " <html> <head> <title> C++ Web Application </title> </head> <body> <b> this page wrote by C++</b> </body> </html> ";
بعد ذلك طبعنا الصفحة بالـ(cout<<)
cout<<page;
باقي حاجة اللي هي ماكرو بسيط للصفحة
#define WEBPAGE cout<<"content-type text/html"
وبعدين تكتبه بعد تعريف الدالةmain))
//simple program
#include <iostream.h>
int main(int argc,char *argv[])
{
WEBPAGE;
return 0;
}وفي النهاية اتمنى ان يعجبكم شرحي
وشكرا
net's einstein


