c++ برامج ,
قسم رياضيات " برمجة (عملي)
برنامج Microsoft Visual c++ 6.0
برنامج Microsoft Visual c++ 6.0
1- Establish folder in data drive (ur name)
2-File-- new-- files-- c++source file-- file name (write any name)-- location-- drives: data ,,directory name: name of folder that u established before in data drives (ur name) -- OK-- OK.
1-First program in c++
طباعة
# include <iostream.h>
Int main()
{ cout<<"welcome to c++\n";
Return 0;
}
***************************************
جمع 3 اعداد
2-Second 3 numbers
# include <iostream.h>
Int main()
{ int x;
Int y;
Int z;
Int sum;
Cout<<"Enter first number\n";
Cin>>x;
Cout<<"Enter second number\n";
Cin>>y;
Cout<<"Enter third number\n";
Cin>>z;
Sum=x+y+z;
Cout<<"sum is"<<sum<<endl;
Return 0;
{
void main()
{
int t;
int w;
int z;
cout<<"Enter ur tall\n";
cin>>t;
cout<<"Enter ur wight\n";
cin>>w;
z=t-100;
if(w==z)
cout<<"ur wight ideal\n";
if(w>z)
cout<<"ur wight is fat\n";
if(w<z)
cout<<"ur wight is thin\n"; i
}
<# include <iostream.h
int main()
{
double r,dr,cr,ar;
const double pi=3.14159;
cin>>r;
dr=2*r;
cr=2*pi*r;
ar=pi*r*r;
cout<<"dr="<<dr<<endl;
cout<<"cr="<<cr<<endl;
cout<<"ar="<<ar<<endl;
Return 0;
}
***********************
الواجب: اكتبي برنامج يحسب مساحة المستطيل؟؟
************************
# include <iostream.h>
************************
3- برنامج ندخل الطول والوزن ويخبرني هل الوزن مثالي ام زائد ام ناقص
# include<iostream.h>void main()
{
int t;
int w;
int z;
cout<<"Enter ur tall\n";
cin>>t;
cout<<"Enter ur wight\n";
cin>>w;
z=t-100;
if(w==z)
cout<<"ur wight ideal\n";
if(w>z)
cout<<"ur wight is fat\n";
if(w<z)
cout<<"ur wight is thin\n"; i
}
***********************************************
4- برنامج ندخل نصف قطر الدائرة ويحسب لي قطر ومحيط ومساحة الدائرة
<# include <iostream.h
int main()
{
double r,dr,cr,ar;
const double pi=3.14159;
cin>>r;
dr=2*r;
cr=2*pi*r;
ar=pi*r*r;
cout<<"dr="<<dr<<endl;
cout<<"cr="<<cr<<endl;
cout<<"ar="<<ar<<endl;
Return 0;
}
***********************
الواجب: اكتبي برنامج يحسب مساحة المستطيل؟؟
************************
5- اكتبي برنامج يطبع ( رحمة الله على الأمير سلطان)
May the mercy of allah be on prince sultan
# include <iostream.h>
void main()
{
cout<<"May the mercy of allah be on prince sultan \n";
}
**************************cout<<"May the mercy of allah be on prince sultan \n";
}
6-اكتبي برنامج يربع عدد ثم يطرح من الناتج 3
# include <iostream.h>
int main()
{
int x;
int seq;
cout<<"Enter the integer number:\n";
cin>>x;
seq=x*x;
cout<<"The result is:\n"<<seq-3<<endl;
return 0;
}
*********************
#include<iostream.h>
void main ()
{
int grade;
cout<<"Enter your grade\n";
cin>>grade;
if (grade>=90)
cout<<"A\n";
if (grade>=80)
cout<<"B\n";
if (grade>=70)
cout<<"C";
if (grade>=60)
cout<<"D\n";
else
cout<<"F\n";
}
****************************
#include<iostream.h>
void main ()
{ char name [20];
int age;
cout<<"what is your name?\n";
cin>>name;
cout<<"how old are you?\n";
cin>>age;
cout<<"Excellent,well done\t"<<name<<endl;
cout<<"you are\t"<<age<<"years old\n";i
}
************************
#include<iostream.h>
int main()
{
for(int i=1;i<=10;i++)
cout<<i<<endl;
return 0;o
{
************************
int main()
{ int x;
int y;
int m;
cout<<"enter first number\n";
cin>>x;
cout<<"enter second number\n";
cin>>y;
m=x*y;
cout<<"the result is"<<m<<endl;
return 0;l
{
7-اكتبي برنامج يدخل درجتك ويطبع تقديرك النهائي
#include<iostream.h>
void main ()
{
int grade;
cout<<"Enter your grade\n";
cin>>grade;
if (grade>=90)
cout<<"A\n";
if (grade>=80)
cout<<"B\n";
if (grade>=70)
cout<<"C";
if (grade>=60)
cout<<"D\n";
else
cout<<"F\n";
}
****************************
8-اكتبي برنامج يطبع اسمك وعمرك
#include<iostream.h>
void main ()
{ char name [20];
int age;
cout<<"what is your name?\n";
cin>>name;
cout<<"how old are you?\n";
cin>>age;
cout<<"Excellent,well done\t"<<name<<endl;
cout<<"you are\t"<<age<<"years old\n";i
}
************************
repetition with for structure
برنامج دوران يطبع الاعداد من 1 الى 10 #include<iostream.h>
int main()
{
for(int i=1;i<=10;i++)
cout<<i<<endl;
return 0;o
{
************************
برنامج ضرب عددين ( مهم )
#include<iostream.h>int main()
{ int x;
int y;
int m;
cout<<"enter first number\n";
cin>>x;
cout<<"enter second number\n";
cin>>y;
m=x*y;
cout<<"the result is"<<m<<endl;
return 0;l
{
تم بحمد الله وتوفيقه ,, , تمنياتي لكم بالتفوق والتميز ,,
,,
IF u need to ask me, u can find me at my office or send me
E-mail : alanoud-algobaisi@hotmail.com
GOOD LUCK <3 ,