PDA

عرض كامل الموضوع : كل ما يخص c++ من برامج ودروس


سيرين
23-01-2008, 09:49
مـــــــــرحـــــــــــبا

كيفـــــــ حـــــــالكم وايش الاخبــــــــــــتر ؟!
اتمنى الجميع يكون بصحه وعافيه .. انتو وكل اللي تحبوهم ,,

اليوم كاااان يوم مرره قـــــــــاسي عليــــــــا ,, حاســـه يتأنيب الضمـــــير .. ما ادري ,, احساس غريب ,, انا نفسي مني قادره افهمه ؟؟ يمكن دا كلوو بسبب التخبيص العنيف اللي هببته في اختبار البرمجه ؟؟
مرره ما حليت ؟؟ والمصيبه اننا طوال الترم بندرس .. وفي الاخير ,, حسيــــــت انو مو براسي البرمجه ابدا :eek:

فوعـــــــــدت نفسي اليوم .. اني انزل موضوع في المنتدى _ وعلى فكره يمكن هادي اول مره انزل فيها موضوع - مختص عن البرمجه بلغه السي ++ من الابتداء للإحتراف .. ةالله يقدرني على تبليغ رسالتي اللي ابغى اوصــــــلها لكم ..

فنصـــــــــــــــــــــــــــــــــــــــــــــــ ــــيحه لوجه الله :

لكل دااارس لهادي اللغه .. ركزووو كويس في المحاضرات ولا تغيبوووو وخلوو بالكم وفكركم كلهم مع البرمجه .. وحاولو تتعمقو وتبحروا فيهااا .. تراها واللهي مو صعبه .. بس يبغاله ممارسه وتصيرووا مبرمجين ميه ميه ::جيد:: حتى وقتها يمكن ما تحتاج لمزاكره يوم الامتحااان


بلـــــــــــــــيز يا جماعه الخير لا تغلطو غلطتي .. انا اهمت مررره في بدايه الترم .. ولمن فوقت على نفسي .. وحاولت الحق مع المنهج .. ما قدرت لانو كل ما اتمكن من حاجه احصل نفسي قدام حااااااااااجه اكبر منها بكتير .. والوقت بيمشي

شي تاني .. لا تخــــــــــلو عواطــــــــــــفكم ومشــــــــــــاعركــــــــم ومشـــــــــاكلكم تاثر على مستقبلكم مهما كان وصاار

وفي الختاااام .. اقولكم اسفــــــــــــه جدا على الاطالـــــــــــــــــــــــه بس يمكن كنـــــــت مره متـــــــــضايقه وما عندي احد احكـــــــــي له .. فحطيت حري فيكم:o

واللي صار معايا في دي الماده خلاني وحفزني اني انزل دا الموضوع ... وادعوو لي انجح من دي الماده

<<----- مره كرهتهااا


تحياتي
سيرين

سيرين
23-01-2008, 10:15
يا جماعه عندي مشكله في تحميل المرفقات
ارجو المساعده

سيرين
28-01-2008, 18:33
ارفقت بعض الدورس الابتدائيه للسي

سيرين
28-01-2008, 18:37
هذا البرنامج يخص المصفوفات

#include <iostream.h>
#include <conio.h>


void main()
{
int i,j,sum=0;
int c[4][2],d[4];

cout<<"enter the elements of array:\n";
for (i=0;i<=3;i++)
for (j=0;j<=1;j++)
cin>>c[i][j];

cout<<"the first array:"<<endl;
for (i=0;i<=3;i++)
for (j=0;j<=2;j++)
cout<<c[i][j]<<'\t'<<endl;

for (i=0;i<=3;i++)
d[i]=sum+i;

cout<<"the result\n";
for (i=0;i<=3;i++)
cout<<d[i]<<'\t'<<endl;


getch();
}

naruto13
28-01-2008, 19:45
اذا ممكن ممكن البرنامج لانه البرنامج العندي مثله لا يعمل

فاذا امكن ممكن ترفعيه انا اعرف عن هذا البرنامج انه يستطيع صنع برامج والعاب وفيديو والكثير

وانا استنى الرابط نار

سيرين
29-01-2008, 20:00
مرحبا
عندي البرنامج في سي دي بس حجمه مررره كبير
ما اقدر ارسلك هو ملف مرفق
لو تعرف موقع تحميل كويس اديني هوه وانا ارفع لك البرنامج عليه
ان شاء الله

سيرين
29-01-2008, 21:05
ارفقت بعض الدروس ..

poison.05
30-01-2008, 15:06
مشكورااااااااااا

على

الموضوع

الموميز

ScOrP!On
01-02-2008, 04:46
يسلمووو على الموضوع

سيرين
01-02-2008, 18:45
االعفوووو
اشكر الجميع على المرور واتمنى فعلا تستفيدوو من موضوعي

تحياتي

سيرين
01-02-2008, 18:48
#include <iostream.h>
#include <conio.h>
#define PI 3.1416
void main()
{
int shape;
float x, a, b, c, h, l, w, r;
char ch, exit;

do
{
cout<<"\n***************************************";
cout<<"\n* Enter your choice 1,2,3,4,5 or 6 *";
cout<<"\n* *";
cout<<"\n* 1. Square *";
cout<<"\n* 2. Triangle *";
cout<<"\n* 3. Rectangle *";
cout<<"\n* 4. Circle *";
cout<<"\n* 5. Diamond *";
cout<<"\n* 6. Exit *";
cout<<"\n***************************************\n";

cin>>shape;

switch(shape)
{
case 1: {
do
{
cout<<"\n\n Enter your choice a, b or c";
cout<<"\n a. area";
cout<<"\n b. circumference";
cout<<"\n c. another shape";
cin>>ch;

switch (ch)
{
case 'a':
{
cout<<"\n Enter the lengh of"
<<"the. square \n";
cin>>x;
cout<<"\n the area of this square="
<<x*x;
}
break;

case 'b':
{
cout<<"\n Enter the lengh of"
<<"the. square \n";
cin>>x;
cout<<"\n the circumference of this square="
<<4*x;
}
break;

}
}
while (ch!='c');
}
break;



case 2:
{
do {
cout<<"\n\n Enter your choice a, b or c";
cout<<"\n a. area";
cout<<"\n b. circumference";
cout<<"\n c. another shape";
cin>>ch;

switch (ch)
{
case 'a':{
cout<<"\n Enter the base and the hight b,h \n";
cin>>b;
cin>>h;

cout<<"\n the area of this triangle ="<<0.5*b*h;
}
break;

case 'b':{
cout<<"\n the three dimension of the triangle a, b, c\n";
cin>>a>>b>>c;

cout<<"\n the circumference of this triangle ="<<(a+b+c);
}
break;
}

}
while (ch!='c');
} break;

case 3:{
do {
cout<<"\n\n Enter your choice a, b or c";
cout<<"\n a. area";
cout<<"\n b. circumference";
cout<<"\n c. another shape";
cin>>ch;

switch (ch)
{
case 'a':
{
cout<<"\n enter the length and the width of the rectangle \n"
cin>>l>>w;

cout<<"\n the area of this rectangle \n"<<(l*w);
} break;


case 'b':{
cout<<"enter the length and the width of the rectangle\n";
cin>>l>>w;
cout<<"\n the circumference of this rectangle ="<<(l+w)*2;
}
break;
}
}
while (ch!='c');
}
break;



case 4:{do {
cout<<"\n\n Enter your choice a, b or c";
cout<<"\n a. area";
cout<<"\n b. circumference";
cout<<"\n c. another shape";
cin>>ch;

switch (ch)
{
case 'a':{ cout<<"\n enter the radius of ther circle \n";
cin>>r;
cout<<"\nthe area of this circle ="<<r*r*PI;
}
break;

case 'b':{ cout<<"\n enter the radius of the circle\n;
cin>>r;
cout<<"\nthe circumference of this circle="<<2*r*PI;
}
break;
}
} while (ch!='c');
}break;


case 5: {
do{
cout<<"\n\n Enter your choice a, b or c";
cout<<"\n a. area";
cout<<"\n b. circumference";
cout<<"\n c. another shape";
cin>>ch;

switch (ch)
{
case 'a':{cout<<"\n Enter the length of two diameters of the diamond\n";
cin>>x>>w;
cout<<"\nthe area of this diamound ="<<0.5*x*w;
}break;

case 'b':{ cout<<"\n enter the length of two diameters of the diamond\n";
cin>>x;
cout<<"\n the circumference of this diamond="<<4*x;
} break;
}
} while (ch!='c');
} break;


case 6:{
cout<<"\n to exit to DOS press any key";
cout<<"\nif you don't want to exit type (n)";
cin>>exit;
if (exit=='n')
shape=0;
}
}
} while(shape!=6);

}


برنامج مررره حلوو يحسب المساحه والحجم لعده اشكال .. مدخله مسبقا

سيرين
02-02-2008, 11:59
// program to check whether the entered year is a leap year or not.

#include <iostream.h>
#include <conio.h>

void main()
{

int leap;


cout<<"Enter the year";
cin>>leap;
if (leap%4==0)

cout<<"the year is a leap year\n ";

else
cout<<"It's not a leap year\n";


getch();
}

سيرين
02-02-2008, 12:05
// program to calculate the root of a quadratic equation.

#include <iostream.h>
#include <conio.h>
#include <math.h>
void main()
{

int a, b, c;
float x1, x2;

cout<<"Enter the value of a, b, c \n";
cin>>a>>b>>c;
if (b*b-4*a*c>0)
{
x1=-b+sqrt(b*b-4*a*c)/2*a;
x2=-b-sqrt(b*b-4*a*c)/2*a;
cout<<"the two roots are "<<x1<<","<<x2;
}

else
cout<<"roots are imaginary\n";


getch();
}

سيرين
02-02-2008, 13:08
// program to count numbers between 1 to 100 not divisible by 2,3,5

#include <iostream.h>
#include <conio.h>

void main()
{
int x,c=0;

for (x=0;x<=100;x++)
{
if (x%2!=0&&x%3!=0&&x%5!=0)
{
cout<<x<<endl;
c=c+1;
}
}
cout<<"the total numbers are "<<c;
getch();
}

سيرين
03-02-2008, 10:16
#include <iostream.h>
#include <conio.h>

int main()
{
int num1 , num2;
float avg , guess ,sum ;

cout<<"\n Enter two numbers separted by space";
cout<<"Then press return "
cin>>num1 >>num2;
cout<<" Now enter your guess of thier average "<<endl;
cin>>guess;

sum = num1 + num2 ;
avg = sum/2;

cout<<"Your Guess is "<<guess<<endl;
cout<<" The right answer is"<<avg;


return 0;
}

سيرين
03-02-2008, 10:16
// program to display the stars in pattern

#include <iostream.h>
#include <conio.h>

void main()
{
int x,i,j;
cout<<"enter the value of x\n";
cin>>x;

for (i=0;i<=100;i++)
{
for (j=1;j<=i;j++)
{
cout<<"*";
}
cout<<"\n";
}

getch();
}

سيرين
03-02-2008, 10:17
// program to calculate the value of number raised to a power

#include <iostream.h>
#include <conio.h>

void main()
{
int num,i,pow;
long ans;

cout<<"enter the number and it's power\n";
cin>>nim>>pow;
ans=1;

for (i=1;i<=pow;i++)
ans=ans*num;
cout<<ans<<"\n";


getch();
}

سيرين
03-02-2008, 10:17
// program to calculate the factorial of a number using for loop

#include <iostream.h>
#include <conio.h>

void main()
{
int n,fact=1;


cout<<"enter the number\n";
cin>>n;

for (int i=1;i<=n;i++)
fact=fact*i;
cout<<"the factorial is"<<fact<<"\n";


getch();
}

سيرين
03-02-2008, 10:18
// program to display the first 10 numbers in reverse order
#include <iostream.h>
#include <conio.h>

void main()
{


for (int i=10;i>0;i--)

cout<<""<<i<<"\n";


getch();
}

سيرين
03-02-2008, 10:19
// program to find the factors of the number
#include <iostream.h>
#include <conio.h>

void main()
{
int i=1, n;
cout<<"enter the number\n";
cin>>n;
while (i<=n)
{
if (n%i==0)
cout<<"the factor of the number"<<i<<"\n";
i++;
}

getch();
}

سيرين
03-02-2008, 10:20
// program to find the number of the digits in a number
#include <iostream.h>
#include <conio.h>

void main()
{
int n, count=0;
cout<<"enter the number\n";
cin>>n;
while (n!=0)
{
count=count+1;
n=n/10;
cout<<"the number of digits in the number is"<<count<<"\n";

}

getch();
}

سيرين
03-02-2008, 10:21
// program to find the reverse of a number using while
#include <iostream.h>
#include <conio.h>

void main()
{
int n, rev=0, r;
cout<<"enter the number\n";
cin>>n;
while (n>0)
{
r=n%10;
rev=rev*10+r;
n=n/10;
}
cout<<"the reverse number is"<<rev<<"\n";


getch();
}

سيرين
03-02-2008, 10:22
// program to output the two integers in increasing order
#include <iostream.h>
#include <conio.h>

void main()
{
int x,y;
cout<<"enter the two numbers\n";
cin>>x>>y;
if (x>y)
{
int temp;
temp=x;
x=y;
y=temp;
}
cout<<x<<"<"<<y<<"\n";


getch();
}

سيرين
03-02-2008, 10:22
// program to find largest of 3 numbers
#include <iostream.h>
#include <conio.h>

void main()
{
int a,b,c,max;
cout<<endl<<"largest of three integer\n";

cout<<"enter first number\n";
cin>>a;
cout<<"enter second number\n";
cin>>b;
cout<<"enter third number\n";
cin>>c;

if ((a>=b)&&(a>=c))
max=a;
else if (b>=c)
max=b;
else
max=c;

cout<<"largest of three integer number:"<<a<<","<<b<<","<<c<<"is\t"<<max;



getch();
return;
}

سيرين
03-02-2008, 10:23
// program to find largest of 4 numbers
#include <iostream.h>
#include <conio.h>

void main()
{
int a,b,c,d,max;
cout<<endl<<"largest of four integer\n";

cout<<"enter first number\n";
cin>>a;
cout<<"enter second number\n";
cin>>b;
cout<<"enter third number\n";
cin>>c;
cout<<"enter fourth number\n";
cin>>d;

if ((a>=b)&&(a>=c)&&(a>=d))
max=a;
else if ((b>=c)&&(b>=d))
max=b;
else if (c>=d)
max=c;
else
max=d;

cout<<"largest of four integer number:"<<a<<","<<b<<","<<c<<","<<d<<"is\t"<<max;



getch();
return;
}

سيرين
03-02-2008, 10:24
// program to illustrates the use of input statements.
#include <iostream.h>
#include <conio.h>
#include <iomanip.h>

int main()
{
int score1,score2,score3;
double average;

cin>>score1>>score2>>score3;
average=(score1+score2+score3)/3.0;

cout<<setiosflags(ios:fixed | ios:showpoint | ios:right);
cout<<endl;
cout<<setw(10)<<"the number are "<<setw(4)
<<score1<<setw(4)<<score2<<setw(4)<<score3<<endl;
cout<<endl;
cout<<setprecision(2);
cout<<setw(10)<<"their average is"<<average<<endl;



getch();
return 0;
}

سيرين
03-02-2008, 10:24
// program to display the const
#include <iostream.h>
#include <conio.h>

int main()
{

double first=18;
double second=7;

const double first_c=20;
const double second_c=3;

cout<<" the result of dividing \n"<<first<<"by"<<second<<"is"
<<first/second<<endl;

cout<<"\n Enter new value:";
cout<<"\n Enter the first number:"<<endl;
cin>>first;
cout<<"\n Enter the second number :"<<endl;
cin>>second;

cout<<"\n The result of dividing"<<first<<"by"<<second<<"is"
<<first/second<<endl;

cout<<"\n\n============================================== ==============\n\n";
cout<<"\nThe result of dividing (const var)"<<first_c<<"by"<<second_c
<<"is"<<first/second<<endl;

cout<<"\n Enter new value (const var):";
cout<<"Enter the first number\n";
cin>>first_c;
cout<<"Enter the second number\n";
cin>>second_c;

cout<<"the result of dividing "<<first_c<<"by"<<second_c<<"is"
<<first_c/second_c<<endl;



getch();
return 0;
}

سيرين
03-02-2008, 10:25
// program to calculate the sum of two number.

#include <iostream.h>
#include <conio.h>

int main()
{

int a=10;
int b=20;
int sum;

a=20;
b=22;
sum=a+b;


cout<<"The sum of two number\n";
cout<<"["<<a<<"]";
cout<<"and ";
cout<<"["<<b<<"]";
cout<<"is";
cout<<"["<<sum<<"]";

cout<<"\n\nThe sum of two number";
cout<<"["<<15<<"]";
cout<<"and";
cout<<"["<<10<<"]";
cout<<"["<<(15+10)<<"]";



getch();
return 0;
}

سيرين
03-02-2008, 10:25
// program to get choices.

#include <iostream.h>
#include <conio.h>
#include <stdlib.h>


void main()
{

char ch;


get_choices:


cout<<"1. check spelling Errors\n";
cout<<"2. correct spelling Errors\n";
cout<<"3. display spelling Errors\n";
cout<<"4. Quit\n";

cout<<"Enter your choice:";
cin>>ch;

switch(ch)
{
case '1':
cout<<"\nOK=> Checking spelling Errors";
break;
case '2':
cout<<"\nOK=> correcting spelling Errors";
break;
case '3':
cout<<"\nOK=> displaying spelling Errors";
break;
case '4':
exit(0);
default :
cout<<"\n\must Enter one of the choices\n\n";
goto get_choice;
}

getch();
return ;
}

سيرين
03-02-2008, 10:26
// program to find largest of positive integer numbers.

#include <iostream.h>
#include <conio.h>



void main()
{

int x, max;
max=-1;
cout<<"\n Largest of positive integer variables";
cout<<endl;


Enter_var:


cout<<"Note: Enter negetive integer variables to stop entering\n";
cout<<"Enter positive integer variable\n";

cin>>x;

if (x>=0)
if (x>=max)
{
max=x;
goto Enter_var;

else
goto Enter_var;

cout<<endl
<<"\n................................................ ......."
<<max
<<"\n................................................ .......";

getch();
return ;
}

سيرين
03-02-2008, 10:27
// program : bankbook.
// the purpose of this program is to update a checking account balance.
//the user enters the amount of the current balance and the amount of the most
//recent check as inputs. the program dispalys the operation of updating
//the balance in the form.
//old balance :$ ddd.dd
//new check: - dd.dd
// ------
//new balance: ddd.dd



#include <iostream.h>
#include <conio.h>
#include <iomanip.h>


int main()
{
double balance, new_check;

cout<<"\nEnter the current balance:";
cout<<balance;

cout<<"\nEnter the amount of the most recently written check:";
cout<<new_check;

cout<<setiosflags(ios::fixed | ios::showpoint);
cout<<setprecision(2);

cout<<"old balance: $"<<setw(8)<<balance<<endl;
cout<<"New check: $"<<setw(8)<<new_check<<endl;
cout<<" ---------"<<endl;
cout<<"new balance: $"<<setw(8)<<balance-new_check<<endl;


getch();
return 0;
}

سيرين
03-02-2008, 10:27
// program to display the price of some books.

#include <iostream.h>
#include <conio.h>
#include <iomanip.h>

int main()
{

double math_text, bio_text, comp_sci_text, total, average;

math_text= 23.95;
bio_text= 27.50;
comp_sci_text= 19.95;
total=math_text+bio_text+comp_sci_text;
average= total/3.0;



cout<<setiosflags(ios::fixed | ios::showpoint | ios::right);
cout<<setprecision(2)<<endl;
cout<<"Text Price"<<endl;
cout<<"---- -----"<<endl;
cout<<endl;
cout<<"math"<<setw(18)<<math_text<<endl;
cout<<"biology"<<setw(15)<<bio_text<<endl;
cout<<"compSci"<<setw(15)<<comp_sci_text<<endl;
cout<<endl;
cout<<"Total"<<setw(17)<<total<<endl;
cout<<endl;
cout<<"Average price"<<setw(9)<<average<<endl;
cout<<"Press any key to continue.";




getch();
return 0;
}

سيرين
03-02-2008, 10:29
#include <iostream.h>
#include <conio.h>

int main()
{
float mark ;
char grade ;

cout<<"plz enter your marks :";
cin>>mark;
if (mark >=90)
grade = 'A';

else if (mark >=80 && mark <90)
grade = 'B';

else if (mark >=70 && mark <80)
grade = 'c';

else if (mark >=60 && mark <70)
grade = 'D';

else
grade = 'F';

cout<<" your Grade is : "<<grade;

getch();
return 0;
}

سيرين
03-02-2008, 10:30
//This program performs math operation:+,*,-,or/between two integer numbers.

#include <iostream.h>
#include <conio.h>
#include <stdlib.h>

void main(void)
{
char ch;
int x,y;

cout<<"This program performs math operation:+,*,-,or/"
<<"between two integer numbers.\n";

cout<<"\n please enter first number:";
if (!(cin>>y))
{
cout<<"\nwrong input";
goto end_prog;
}
cout<<"\nplease enter second number:";

if (!(cin>>y))
{
cout<<"\nwrong input";
goto end_prog;
}

cout<<"\n please enter : (1) for Add.\n"
<<" (2) for multiply.\n"
<<" (3) for difference.\n"
<<" (4) for divide.\n";

cout<<"\nYour choice is:";
cin>>ch;

switch(ch)
{
case '1':
cout<<"\n x + y ="<<x+y;
break;

case '2':
cout<<"\n x * y ="<<x*y;
break;

case '3':
cout<<"\n x - y ="<<x-y;
break;

case '4':
cout<<"\n x / y ="<<(double) x/(double) y;
break;


default :
cout<<"\n wrong input";
cout<<"\n program will be terminated, press enter";
getch();
exit(0);
}

end_prog:
getch();
return;
}

سيرين
03-02-2008, 18:12
//Program to demonstrate the call by value

#include<iostream.h>
#include<conio.h>

void main( )
{
int x,y;
int change (int, int);
cout<<"enter the value of X and Y\n";
cin>>x>>y;
change(x,y);
cout<<"In the main() the value of X and Y are "<<x<<'\t'<<y<<endl;
getch( );
}

int change(int a, int b)
{
int k;
k=a;
a=b;
b=k;
cout<<"In the change() the value of X and Y are " << a <<'\t'<< b<<endl;

}

سيرين
03-02-2008, 18:13
//Program to demonstrate the call by reference

#include<iostream.h>
#include<conio.h>

void main( )
{
int x,y;
int change (int &, int &);
cout<<"enter the value of X and Y\n";
cin>>x>>y;
change(x,y);
cout<<"In the main() the value of X and Y are "<<x<<'\t'<<y<<endl;
getch( );
}

int change(int &a, int &b)
{
int k;
k=a;
a=b;
b=k;
cout<<"In the change() the value of X and Y are " << a <<'\t'<< b<<endl;

سيرين
03-02-2008, 18:14
//Program to calculate the sum of n numbers using recursive function

#include<iostream.h>
#include<conio.h>

void main( )
{
int sum(int);
int n, temp;
cout<<"enter the number\n";
cin>>n;
temp=sum(n);
cout<<"the sum of numbers is "<<temp<<endl;
getch( );
}
int sum(int n) // recursive function
{
int sum(int); //local function declaration
int value=0;
if (n==0)
return (value);
else
value=n+sum(n-1);
return (value);
}

سيرين
03-02-2008, 18:14
//Program to calculate the factorial of the number using recursive function
#include<iostream.h>
#include<conio.h>
void main( )
{
long int fact( long int);
int x,n;
cout<<"enter the number\n";
cin>>n;
x=fact(n);
cout<<"the factorial is "<<x<<endl;
getch( );
}
long int fact (long int n)
{
long int fact (long int);
int value=1;
if (n==1)
return (value);
else
{
value=n*fact(n-1);
return (value);
}
}

سيرين
03-02-2008, 18:15
Program to display to print bytes reserved for various types of data & space required storing them in memory using arrays

#include<iostream.h>
#include<conio.h>
void main( )
{
int i[10];
char c[10];
float f[10];
cout<<"The type char requires "<< sizeof(char) << " bytes "<<endl;
cout<<"The type float requires " << sizeof(float)<< " bytes "<<endl;
cout<<"The memory locations reserved for 10 char elements " << sizeof(c) <<endl;
cout<<"The memory locations reserved for 10 float elements " << sizeof(f) <<endl;
getch( );
}

سيرين
03-02-2008, 18:15
//Program to enter the numbers from the keyboard, to store it in one dimensional array and display the contents


#include<iostream.h>
#include<conio.h>
void main( )
{
int a[100];
int i,n;
cout<<"How many numbers are in the array \n";
cin>>n;
cout<<"enter the elements of the array "<<endl;
for(i=0;i<=n-1;i++)
{
cin>>a[i];
}
cout<<"The contents of the array are " <<endl;
for(i=0;i<=n-1;i++)
cout<<a[i]<<'\t';
getch( );
}

سيرين
03-02-2008, 18:17
//Program to find the largest number in the given array

#include<iostream.h>
#include<conio.h>
void main( )
{
int a[100];
int i,n,large;
cout<<"how many numbers are there in the array "<<endl;
cin>>n;
cout<<"enter the numbers of the array " <<endl;
for(i=0;i<=n-1;i++) {
cin>>a[i]; }
cout<<"The contents of the array are "<<endl;
for(i=0;i<=n-1;i++) {
cout<<a[i]<<'\t'; }
cout<<endl;
cout<<"****************************************"<<endl;
large=a[0];
for(i=0;i<n-1;i++) {
if (large<a[i])
large=a[i]; }
cout<<"The largest value in the array is "<<large<<endl;
getch( );
}

سيرين
03-02-2008, 18:17
Program to sort the array in ascending order

#include<iostream.h>
#include<conio.h>
void main( )
{
int a[100];
int i,n,j,temp;
cout<<"how many numbers are there in the array "<<endl;
cin>>n;
cout<<"enter the numbers of the array " <<endl;
for(i=0;i<=n-1;i++) {
cin>>a[i]; }
cout<<"The contents of the array are "<<endl;
for(i=0;i<=n-1;i++) {
cout<<a[i]<<'\t'; }
cout<<endl;
cout<<"****************************************"<<endl;
for(i=0;i<=n-1;i++) {
for (j=0;j<=n-1;j++)
if (a[i]<a[j]) {
temp=a[i];
a[i]=a[j];
a[j]=temp; }
}
cout<<"the contents of the arrray in the sorted form is " <<endl;
for(i=0;i<=n-1;i++) {
cout<<a[i]<<'\t'; }
getch( );
}

سيرين
03-02-2008, 18:18
Program to calculate the sum of elements in an array

#include<iostream.h>
#include<conio.h>
void main( )
{
int a[100];
int i,n,value=0;
cout<<"how many numbers are there in the array "<<endl;
cin>>n;
cout<<"enter the numbers of the array " <<endl;
for(i=0;i<=n-1;i++)
{
cin>>a[i];
}
cout<<"The contents of the array are "<<endl;
for(i=0;i<=n-1;i++)
{
cout<<a[i]<<'\t';
}
cout<<endl;
cout<<"****************************************"<<endl;
for (i=0;i<=n-1;i++)
{
value= value+a[i];
}
cout<<"The sum of elements in the array is " <<value<<endl;
getch();
}

سيرين
03-02-2008, 18:19
//Program to initialize a set of numbers in a two dimensional array and display the values

#define N 3
#define M 4
#include<iostream.h>
#include<conio.h>
void main( )
{
int i,j;
float a[N][M]= {
{1,2,3,4},
{5,6,7,8},
{9,10,11,12}
};
cout<<"Content of the array "<<endl;
for (i=0; i<=N-1; i++)
{
for (j=0;j<=M-1;j++)
cout<<a[i] [j] << '\t';
cout<<endl;
}
getch( );
}

سيرين
03-02-2008, 18:19
Program to initialize only few elements in a two dimensional array and display the values

#define N 3
#define M 4
#include<iostream.h>
#include<conio.h>
void main( )
{
int i,j;
float a[N][M]= {
{1,2,3},
{5,6,7},
{9,10,11,12}
};
cout<<"Content of the array "<<endl;
for (i=0; i<=N-1; i++)
{
for (j=0;j<=M-1;j++)
cout<<a[i] [j] << '\t';
cout<<endl;
}
getch( );
}

سيرين
03-02-2008, 18:30
مرحبا
ارفقت في الملفات .. بعض التمارين الغير محلوله ..
مفيده جدا واغلبها سهله::جيد::

سيرين
03-02-2008, 18:39
مرحبا
ارفقت في الملفات .. بعض التمارين الغير محلوله ..
مفيده جدا واغلبها سهله ::جيد::

سيرين
03-02-2008, 18:43
//Program to calculate the sum of two numbers using functions

#include <iostream.h>
#include<conio.h>

void main( )
{
int add(int, int);
int x,y,sum;
cout<<"enter two numbers\n";
cin>>x>>y;
sum=add(x,y);
cout<<"the sum of two numbers is = " <<sum;
getch( );
}

int add(int a, int b)
{
return(a+b);
}

سيرين
03-02-2008, 18:59
 Example: printing "a table" of multiples of 2..4 with 1..5.
#include <iomanip.h>

void main()
{
int First, Second;

for (First = 2; First <= 4; ++First)
{
for (Second = 1; Second <= 5; ++Second)
cout << setw(2) << First * Second << " ";
cout << endl;
}
}

سيرين
03-02-2008, 19:01
//Program to find the maximum of three numbers using functions

#include <iostream.h>
#include<conio.h>

void main( )
{
float maximum(float, float, float);
float x,y,z,max;
cout<<"enter three numbers\n";
cin>>x>>y>>z;
max=maximum(x,y,z);
cout<<"maximum = " <<max;
getch( );
}

float maximum(float a, float b, float c)
{
if (a>b)
{
if(a>c)
return(a);
else
return(c);
}
else
{
if (b>c)
return(b);
else
return(c);
}
}

سيرين
03-02-2008, 19:01
// Program to find the factorial of the number using functions
#include<iostream.h>
#include<conio.h>
void main(void)
{
long int fact(int);
int x,n;
cout<<"enter the number"<<endl;
cin>>n;
x=fact(n);
cout<<"value= " <<n<< "and its factorial = ";
cout<<x<<endl;
getch( );
}
long int fact(int n)
{
int value=1;
if (n==1)
return(value);
else
{
for(int i=1; i<=n; i++)
value=value*i;
return(value);
}

}

سيرين
03-02-2008, 19:04
// Program to display a message.
//Program for function with no arguments and no return value

#include<iostream.h>
#include<conio.h>
void main( )
{
void message( );
message( );
getch( );
}



void message( )
{
cout<<"have a nice day";
}

سيرين
03-02-2008, 19:05
//Program for function with arguments and no return values
//Program to calculate the square of first 5 numbers.

#include<iostream.h>
#include<conio.h>
main( )
{
int j;
void sqr(int);
for (j=1; j<=5;j++)
sqr(j);
getch( );
}
void sqr(int k)
{
cout<<"The square is "<< k*k<<endl;
}

سيرين
03-02-2008, 19:06
//Program to calculate the square root of a number

#include <math.h>
#include <iostream.h>
#include<conio.h>
void main()
{
for (int x=0; x<6; x++)
cout<<"\t"<<x<<"\t"<<sqrt(x)<<endl;
getch( );
}

سيرين
03-02-2008, 19:09
//Program to use the mathematical function "fabs( )"which returns the absolute value of the integer.

#include <math.h>
#include <iostream.h>
#include<conio.h>

void main()
{
int x;
cout<<"enter the number\n";
cin>>x;
int y;
y=fabs(x);
cout<<y<<endl;
getch( );
}

سيرين
03-02-2008, 21:26
 Another example mixing a loop through characters with one through integers.
#include <iostream.h>

void main()
{
char Letter;
int Digit;

for (Letter = 'A'; Letter <= 'C'; Letter++)
{
for (Digit = 1; Digit <= 3; Digit++)
cout << Letter << setw(1) << Digit;
cout << endl;
}

}

سيرين
03-02-2008, 21:27
 Example: read numbers and print stars
#include <iostream.h>

void main()
{
int Count, Number;

do
{
cout << "Enter a number: ";
cin >> Number;
for (Count = 1; Count <= Number; ++Count)
cout << "*";
cout << endl;
}
while (Number != 0);

}

سيرين
03-02-2008, 21:28
 Example: read numbers from the user until zero is read. For each one tell the user whether it is even or not.
#include <iostream.h>

void main()
{

int Number;

do
{
cout << "Enter a number: ";
cin >> Number;
if (Number % 2 == 0)
cout << Number << " is even" << endl;
else
cout << Number << " is odd" << endl;
}
while (Number != 0);

}

سيرين
03-02-2008, 21:29
The even/odd program prints out "0 is even", when the user has indicated the end of the list of numbers. To remove this rewrite the loop as a while loop as follows:
#include <iostream.h>

void main()
{
int Number;

cout << "Enter a Number: ";
cin >> Number;
while (Number != 0)
{
if (Number % 2 == 0)
cout << Number << " is even" << endl;
else
cout << Number << " is odd" << endl;
cout << "Enter a number: ";
cin >> Number;
}

}
A drawback is that the cout/cin statements are repeated

سيرين
03-02-2008, 21:30
Example: Find Maximum
Using While

//Find the maximum value of a list of positive numbers
//Input: A list of numbers
//Output: Maximum value of the numbers entered
#include < iostream.h >

void main()
{

int value, //input value
maxval; //Maximum value

value = 0; //initialize value
maxval = 0; //initialize maxval

while ( value != 0 )
{
cout <<"Enter a value (-1 to stop): ";
cin >> value;
if( value > maxval )
maxval= value; //new maximum
}

cout <<"The maximum value found is " << maxval << endl;
}

سيرين
03-02-2008, 21:31
Using do-while
//Find the maximum value of a list of positive numbers
//Input: A list of numbers
//Output: Maximum value of the numbers entered
#include < iostream.h >

void main() {

int value, //input value
maxval; //Maximum value

maxval = 0; //initialize maxval

do{
cout <<"Enter a value (-1 to stop): ";
cin >> value;
if( value > maxval )
maxval = value; //new maximum
} while ( value != -1 )

cout <<"The maximum value found is " << maxval << endl;

}

سيرين
03-02-2008, 21:32
Example: Summation
//Program to find the sum of numbers from 1 to n
//Input: n
//Output: sum of numbers from 1 to n

#include < iostream.h >

void main()
{

int n, //input number
sum, //initialize sum to 0
i;

cout <<"Enter a positive number: ";
cin >> n;

i = 1;
sum = 0;

while( i < n )
{
sum = sum + i;
i++; // i = i + 1
}

cout <<"The sum of numbers from 1 to "
<< n << " is " << sum << endl;
}

سيرين
03-02-2008, 21:33
Example: Exponents
Using while

//Program to raise a number to the nth power
//input: number and exponent "n"
//Output: number to the nth power

#include < iostream.h >

void main() {

int number, n, //input number & exponent
result = 1; //initialize result to 1

cout <<"Enter number: "; cin >> number;
cout <<"Enter exponent: "; cin >> n;

while( n >= 1 ) {
result = result * number;
n--; //n = n - 1
}

cout << number << "to the power " << n << " = " result << endl;
}

سيرين
03-02-2008, 21:34
Using For
//Program to raise an integer to the nth power
//Input: integer and its positive integer exponent "n"
//Output: integer to the nth power

#include < iostream.h >

void main() {

int number, n, //input number & exponent
result = 1; //initialize result to 1

cout <<"Enter integer: "; cin >> number;
cout <<"Enter exponent: "; cin >> n;

if( n < 0 )
cout <<"Exponent is negative; program stops. \n";
else
if( n == 0 )
cout << number <<" to the power " << n << "=1.\n";
else {
for( int i=n; i>0; i--)
result = result * number;

cout << number <<" to the power "<< n << "="
<< result << endl;
}
}

سيرين
03-02-2008, 21:35
Example: Factorial Computation
//Program to compute a factorial
//Input: positive integer to compute factorial of (n)
//Output: n! = 1 * 2 * 3 * .. * n

#include < iostream.h >

void main() {

int n, fact;

cout << "Enter positive integer:";
cin >> n;

if( n <= 0 )
cout <<"Not a positive integer, program stops.\n";
else {
fact = 1; //initialize product
for(int i=1; i<=n; i++)
fact *= i;

cout << n << "! is " << fact << endl;
}
}

سيرين
03-02-2008, 21:36
Example: Find the average score on 8 tab assignments
#include < iostream.h >

void main() {

int i, tasttab = 8;
double avg, score, total_score;
char resp;
do{
total_score = 0;
for( i=1; i <=tasttab; i++){
cout<<"Enter the student's score for the lab "<< i <<".";
cin >> score;
total_score += score;
}
avg = total/score / double(tasttab);
cout <<"The average score is " << avg << endl;
cout <<"Enter another student? (Type Y or N): ";
cin >> resp;
} while(resp == 'Y' || resp == 'y');
}

سيرين
03-02-2008, 21:39
Example: Print out the following diamond pattern
*
***
*****
*******
*********
*******
*****
***
*
//Print out a diamond pattern
#include < iostream.h >
void main(){
int row, space, asterisk;

//top half
for(row=1; row<=5; row++)
{
for(space=1; space<=5-row; space++)
cout << " ";

for(asterisk=1; asterisk<=2*row-1; asterisk++)
cout << "*";

cout << endl ;
}

//bottom half
for(row=4; row>=1; row--)
{
for(space=1; space<=5-row; space++)
cout << " ";

for(asterisk=1; asterisk<=2*row-1; asterisk++)
cout << "*";

cout << endl ;
}
}

سيرين
03-02-2008, 21:39
 Example: List all Primes (think how to solve it)
o The program allows the user to enter positive integers from the keyboard.
o Only positive integers or -999 will be accepted (data validation).
o The number -999 is used to terminate the execution of the program.
o For each positive integer, all prime numbers from 2 upto the positive integer are displayed.
o A number is prime if is has no divisors less than its square root.
Sample output:
Enter a positive integer; <-999> to quit: 17

The number is 17.
The prime numbers less than or equal to 17 are:
2
3
5
7
11
13
17

Enter a positive integer; <-999> to quit: -9

Enter a positive integer; <-999> to quit: -999

سيرين
03-02-2008, 21:40
Problem: Write a program that converts a binary number to decimal notation.
Include a loop that lets the user repeat this computation for new
input values again and again until the user says he or she wants
to end the program.

#include <iostream.h>
#include <conio.h>
#include <math.h>
//---------------------------------------------------------------------------
void main()
{
long int binary;
int i;
int decimal;
int dig;
char ans;
do
{
cout<<"Enter a binary number : ";
cin>> binary;
decimal = 0;
i= 0;
do
{
dig = binary % 10;
decimal = decimal + dig * pow(2,i);
binary = binary / 10;
i++;
} while( binary != 0);
cout<<"The number in decimal base is : " << decimal<<endl;
cout<<"Continue (Y/N) ? : " ;
cin>> ans;
}while(ans=='Y' || ans=='y');
getchar();
}

سيرين
03-02-2008, 21:41
Problem: Write a program that allow to the user enter a integer number as input
and show the number in backwords as output.Your program should include
a loop that lets the user repeat this calculation until the user
says she or he is done.

#include <iostream.h>
#include <conio.h>
//---------------------------------------------------------------------------
void main()
{
int number;
int Ninv;
int dig;
char ans;
do
{
cout<<"Enter a Number : " ;
cin>> number;
Ninv = 0;
while (number != 0 )
{
dig = number % 10;
number = number / 10;
Ninv = (10 * Ninv ) + dig;
}// end while number != 0
cout<<"The number in backwords is : "<< Ninv << endl;
cout<<endl;
cout<<"Do you want to continue (Y/N) ?";
cin>> ans;
} while( ans == 'Y' || ans =='y' );
getchar();
return 0;
}

سيرين
03-02-2008, 21:43
Problem: Write a program to evaluate if a integer number is a Perfect Cube or
number of Armstrong ( Number > 1 ).Your program should include
a loop that lets the user repeat this calculation until the user
says she or he is done.
Note: if abc is perfect cube then abc = a^3 + b^3 + c^3
e.g., 153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153

#include <iostream.h>
#include <conio.h>
//---------------------------------------------------------------------------
void main()
{
int number;
char ans;
do
{
do
{
cout<<"Enter a Integer Number greater than 1 : ";
cin>>number;
}while ( number <= 1);
int result;
int Naux;
result = 0;
Naux = number;
int dig;
while (Naux != 0)
{
dig = Naux % 10;
Naux = Naux / 10;
result = result + pow(dig,3);
}// end while (Naux != 0)
if (number == result)
cout<<"The number is PERFECT CUBE !!!"<<endl;
else
cout<<"The number is NOT PERFECT CUBE "<<endl;
cout<< "Continue (Y/N) : ";
cin>> ans;
}while(ans=='Y' || ans=='y');
getchar();
}

سيرين
03-02-2008, 21:44
Problem: Write a program that allow to the user calculates the prime factors
of any number with its powers (exponents).Your program should include
a loop that lets the user evaluate other number again until the
user says he or she is done.
Example; Enter a number : 17424 //input
// Output in the screen should be:

Factor Exponent
2 4
3 2
11 2
Do you want to continue ( Y/N) ? : _
Note: 17424 = (2^4) * (3^2) * (11^2)
Hint: use integer division ( / ) and % operator
#include <iostream.h>
#include <conio.h>
#include <iomanip.h>
//---------------------------------------------------------------------------
void main()
{
int number;
int factor;
int exponent;
char ans;
do
{
cout<<"Enter a Number : ";
cin>> number;
cout<<"Factor"<<setw(15)<<"Exponent"<<endl;
factor = 2;
while ( number != 1)
{
exponent = 0;
while ( number % factor == 0)
{
exponent ++;
number = number / factor;
} // end while ( number % factor == 0)
if ( exponent > 0 )
cout<<setw(3)<<factor<<setw(15)<<exponent<<endl;
factor ++;
} // end while ( number <> 1)
cout<<"Do you want to continue (Y/N) ? : ";
cin>> ans;
} while ( ans =='Y' || ans =='y' );
getchar();
}

سيرين
03-02-2008, 21:45
Problem: Write a program to evaluate the following sum:
1/3 + 1/15 + 1/35 +....+ 1/((2n-1)*(2n+1))
where 1/((2n-1)*(2n+1)) is the n-term of the expresion.
The program shoul take a limit value for the n-term as input and output
the sum.
#include <iostream.h>
#include <conio.h>
#include <iomanip.h> // needed for setprecision
//---------------------------------------------------------------------------
int main(int argc, char* argv[])
{
cout<<"************************************************** ******************"<<endl;
cout<<"This program is going to evaluate the folowing expresion:" <<endl;
cout<<endl;
cout<<" 1/3 + 1/15 + 1/35 +....+ 1/((2n-1)*(2n+1))"<<endl;
cout<<endl;
cout<<"You have to enter a limite for the n-term e.g., 0.0001"<<endl;
cout<<"************************************************** ******************"<<endl;
cout<<endl;
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
double lim;
cout<<"Enter the limit of the term : ";
cin>> lim;
double n ; // if we use int n then term always will be 0 for integer division
double sum;
double term;
n=1 ;
sum=0;
do
{
term = 1/((2*n)*(2*n+1)); // be carefull in the data type of n
sum = sum + term;
n++;
} while ( term > lim );
cout<<"The Sum is = "<<setprecision(15)<< sum<<endl;

getchar();

سيرين
03-02-2008, 21:45
Problem: Write a program that will read in a long integer number and will
output how many times each digit is present in the number.
Example, Input/Output:

Enter a number: 723345167
Digit # of Repetitions
----- & ----------------
1 1
2 1
3 2
4 1
5 1
6 1
7 2
//---------------------------------------------------------------------------
#include <iostream.h>
#include <conio.h>
#include <iomanip.h>
//---------------------------------------------------------------------------
#pragma argsused
int main(int argc, char* argv[])
{
long int number, auxn;
int digit, dig, counter;
cout<<"Enter a number : ";
cin>>number;
cout<<endl;
cout<<"Digit"<<setw(25)<<"# of Repetitions"<<endl;
cout<<"-----"<<setw(25)<<"------------------"<<endl;
for (digit = 0; digit <=9; digit++)
{
auxn= number;
counter = 0;
while ( auxn != 0)
{
dig = auxn % 10;
auxn = auxn / 10;
if (dig == digit)
counter++;
}// end while ( auxn != 0)
if (counter > 0)
cout<<setw(3)<<digit<<setw(15)<<counter<<endl;
}// end for (digit = 0; digit <=9; digit++)

getchar();
}

سيرين
03-02-2008, 21:46
Problem: Write a program that accepts a integer number greater than zero and less
than 400 as a three-digit Arabic (ordinary) numeral and outputs the
number written in Roman numerals.Important Roman numerals are: I for 1,
V for 5, X for 10, L for 50, C for 100. Recall that some numbers are
formed by using a kind of subtraction of one Roman digit; e.g.,
IV is 4 produced as V minus I, XL is 40, XC is 90 etc. Your program
should include a loop that lets the user repeat this calculation until
the user says she or he is done.
#include <iostream.h>
#include <conio.h>
//---------------------------------------------------------------------------
void main()
{
int number,cent,dec,unid,r,i;
char ans;
do
{
do
{
cout<<"Enter number to evaluate : ";
cin>> number;
}while(number <= 0 || number >= 400);
cent = number / 100;
r = number % 100;
dec = r / 10;
unid = r % 10;
cout<<"The number written in Roman numerals is: ";
for( i=1; i<= cent ; i++)
cout<<"C";
switch(dec)
{
case 1:
cout<<"X";
break;
case 2:
cout<<"XX";
break;
case 3:
cout<<"XXX";
break;
//other way
/* case1:
case2:
case3:
for(i=1; i<=dec;i++)
cout<<"X";
break;
*/
case 4:
cout<<"XL";
break;
case 5:
cout<<"L";
break;
case 6:
cout<<"LX";
break;
case 7:
cout<<"LXX";
break;
case 8:
cout<<"LXXX";
break;
case 9: cout<<"XC";
break;
}
switch(unid)
{
case 1:
cout<<"I";
break;
case 2:
cout<<"II";
break;
case 3:
cout<<"III";
break;
case 4:
cout<<"IV";
break;
case 5:
cout<<"V";
break;
case 6:
cout<<"VI";
break;
case 7:
cout<<"VII";
break;
case 8:
cout<<"VIII";
break;
case 9:
cout<<"IX";
break;
}
cout<<endl;
cout<<endl;
cout<<"Do you want to continue(Y/N) ?: ";
cin>>ans;
}while(ans=='Y' || ans=='y');
getchar();
}

سيرين
03-02-2008, 21:49
// print the squares of 1,3,5,7,9 odd numbers?
int i;
int num = 1;

for (i = 1; i <= 5; i++)
{
cout << i << " The square of " << num
<< " is " << num*num << endl;
num += 2;
}

This would produce:

1. The square of 1 is 1
2. The square of 3 is 9
...
5. The square of 9 is 81

سيرين
03-02-2008, 21:50
// Program to calculate average temperatures from
// user input.
// User enters -999 or less to quit

#include <iostream>
void main()
{
int aTemp;
int tempSum = 0;
int tempCount = 0;

cout << "\nEnter a temperature (-999 to quit): ";
cin >> aTemp;
while (aTemp > -999)
{
tempCount++;
tempSum += aTemp;
cout << "\nEnter next temperature (-999 to quit): ";
cin >> aTemp;
}
cout << "\nAverage is " << (double)tempSum/tempCount;
}

سيرين
03-02-2008, 21:51
// Program to calculate average speeds from user input
// User is asked after each value of there is more data.

#include <iostream>

void main()
{
int aSpeed;
int speedSum = 0;
int speedCount = 0;
char choice = ‘y’;

while (choice == ‘y’) // see note below
{
cout << "\nEnter a speed: ";
cin >> aSpeed;
speedCount++;
speedSum += aSpeed;
cout << "\nAnother? (y/n) ";
cin >> choice;
}
cout << "\nAverage is " << (double)speedSum/speedCount;
}

سيرين
03-02-2008, 21:53
//Print 1 2 4 8 16 32 64 128 256

#include <iostream>
void main()
{ int n; //used to 'drive' the loop
for (n = 1; n<500; n*=2)
{ cout<<n<<"\n";
} //for loop
} //main

سيرين
03-02-2008, 21:54
//Print 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5

#include <iostream>
void main()
{ double n; //used to 'drive' the loop
for (n = 0; n<5.0; n=n+0.5)
{ cout<<n<<"\n";
} //for loop
} //main

سيرين
03-02-2008, 21:56
//Alphabet: Print the alphabet with for loop

#include <iostream>
void main()
{ char letter; //used to 'drive' the loop
for (letter='A'; letter<='Z'; letter++)
{ cout<<letter; //no \n, alphabet will be one line
} //for loop
cout<<"\n"; //go to a new line after printing alphabet
} //main

سيرين
03-02-2008, 21:57
//Count 5, 10, 15, 20, 25, 30, 35, 40, 45
#include <iostream>
void main()
{ int n; //used to 'drive' the loop
for(n=5; n<50; n+=5) //count by 5
cout<<n<<"\n";
} //main

سيرين
04-02-2008, 00:10
#include <iostream.h>
#include <conio.h>

void main()
{

// student declaration
long int studentno;
char name[20], nationlity[15], faculty[10];
char major[20], term[10], rundate[10];

// first course declaration
char course1[10], section1[10], description1[25];
char meet1[5], departmant1[10];
float unit1, from1, to1;
int bld1, room1;

//second course declaration
char course2[10], section2[10], description1[25];
char meet2[5], department2[10];
float unit2, room2;

clrscr();

//****** Introduceing *****
cout<<"This is an information form to replace in Student class schedule";

//***** Student information form *****

cout<<"\n\n please rnter th information in order:";
cout<<"\n student name:";
cin>>name;
cout<<"\n computer no.:";
cin>>studentno;
cout<<"\n Nationality :";
cin>>nationlity;
cout<<"\n Faculty :";
cin>>faculty;
cout<<"\n Major :";
cin>>major;
cout<<"\n Term :";
cin>>term;
cout<<"\n Run date :";
cin>>rundate;

clrscr();

//***** First course information *****

cout<<"\n Now, please enter the course no.1";
cout<<"\n Department :";
cin>>department1;
cout<<"\n Course :";
cin>>course1;
cout<"\n Description :";
cin>>description1;
cout<<"\n Section :";
cin>>section1;
cout<<"\n Unit :";
cin>>unit1;
cout<<"\n Meeting (SSMTW) :";
cin>>meet1;
cout<<"\n Lecture time from :";
cin>>from1;
cout<<"\n to :";
cin>>to1;
cout<<"\n Lecture location ....:\n Building:";
cin>>bld1;
cout<<"\n Room :;
cin>>room1;

clrscr();

//***** Second course information *****

cout<<"\n Now, please enter the course no.2";
cout<<"\n Department :";
cin>>department2;
cout<<"\n Course :";
cin>>course2;
cout<"\n Description :";
cin>>description2;
cout<<"\n Section :";
cin>>section2;
cout<<"\n Unit :";
cin>>unit2;
cout<<"\n Meeting (SSMTW) :";
cin>>meet2;
cout<<"\n Lecture time from :";
cin>>from2;
cout<<"\n to :";
cin>>to2;
cout<<"\n Lecture location ....:\n Building:";
cin>>bld2;
cout<<"\n Room :;
cin>>room2;

clrscr();

//***** The schedule form *****
cout<<"__________________________________________________ ___";

cout<<"\n\t\t\t KING ABDULAZIZ UNIVERSITY ";

cout<<"__________________________________________________ ___";

cout<<"\n\t\t\t STUDENT CLASS SCHEDULE \n ";

cout<<"\n REGISTRAION NO. \t\t\t\t\t RUN DATE \N";
cout<<studentno<<"\t\t\t\t\t\t"<<rundate;
cout<<"\n NAME \t\t\t\t\t\t\t FACULTY\n";
cout<<name<<"\t\t\t\t\t"<<faculty;
cout<<"\n Nationality \t\t\t\t\t\t Major \n";
cout<<nationality<<"\t\t\t\t\t"<<major;

getch();
}

سيرين
04-02-2008, 00:11
// program to confirm that an entered number is a positive

#include <iostream.h>
#include <conio.h>

void main()
{
int x;
cout<<"\n Enter the variable ";
cin>>x;

if (x>=0)
cout<<"\n the number"<<x<<"\t is a positive\n";
cout<<"end the program";

getch();
}

سيرين
04-02-2008, 00:12
// program to confirm wheather an entered number is a positive or negative

#include <iostream.h>
#include <conio.h>

void main()
{
int x;
cout<<"\n Enter the number ";
cin>>x;

if (x>=0)
cout<<"\n the number\t"<<x<<"\t is a positive\n";
else
cout<<"\n the number\t"<<x<<"\t is a negative\n";
cout<<"end the program";

getch();
}

سيرين
04-02-2008, 00:15
// program to find the value of f(x,y) as the fllowing
//
// x*x - y*y -5 for x<0 and y>0
// f(x,y)= 2*x - 5*y +6 for x>0 and y<=3
// 2*y - 10*x*x - 3 for x=4 or y=5
// 0 otherwise


#include <iostream.h>
#include <conio.h>

void main()
{
int x, y, Fxy;
cout<<"\n Enter the two number ";
cin>>x>>y;

if (x<0 && y>0)
Fxy= x*x - y*y -5;
else if (x>0 && y<=3)
Fxy= 2*x - 5*y +6;
else if ( x==4 || y==5)
Fxy= 2*y - 10*x*x - 3;
else
Fxy =0;

cout<<"\n The value of f("<<x<<","<<y<<")="<<Fxy;


getch();
}

سيرين
04-02-2008, 00:16
#include <iostream.h>
#include <conio.h>

void main()
{
int i, sign=-1,;
float term, sum=1.0;

for (i=2;i<=20;i+=2)
{
term = sign * ( 1.0/(float)i;
sum += term;
sign *=-1;

}

cout<<"\n The sum = "<<sum;




getch();
}

سيرين
04-02-2008, 00:17
// program to swap numbers
#include <iostream.h>
#include <conio.h>

void swap (int& x, int& y);
void main()
{
int x=100;
int y=200;
int iTmp;
//x=100 and y=200

cout<<"\n x ="<<x<<"and y ="<<y<<endl;
iTmp = x;
x =y;
y = iTmp;

// x=200 and y=100
cout<<"\n x ="<<x<<"and y ="<<y;


getch();
return;
}

سيرين
10-02-2008, 01:28
مرحبا من جديد

ارفقت بعض التطبيقاات والتمارين الغير محلوله

MexFX
12-02-2008, 09:35
ما شاء الله عليش أختي سيرين , ملئتي موضوعك أمثلة مفيدة


تم تحميل التمارين من ردك الأخير وجار البحث عن وقت لحلها ووضعها هنا :p:p:p

أتمنى أن تستمري , لكن مع طلب , يا ليت تحطي الكود بين وسمي كود PHP حق المنتدى عشان تطلع مرتبة وملونة


// program to swap numbers
#include <iostream.h>
#include <conio.h>

void swap (int& x, int& y);
void main()
{
int x=100;
int y=200;
int iTmp;
//x=100 and y=200

cout<<"\n x ="<<x<<"and y ="<<y<<endl;
iTmp = x;
x =y;
y = iTmp;

// x=200 and y=100
cout<<"\n x ="<<x<<"and y ="<<y;


getch();
return;
}
فقط ظللي الكود بعد وضعه في صندوق التحرير وأضغطي زر PHP الموجود على يسار رمز (شارب) #...

كذلك , قد يكون من الجيد لو أتبعتي كل مثال بشرح مختصر جددداً , فالبعض قد يكونون جديدين على اللغة ويريدين شوية كلام نظري ...:)
وشوية حاجات ثانية بخليها لبعدين ....

جاناه , وشكراً

KSA girl
17-02-2008, 15:46
مشكووووووره
والله مفيد ذا البرنامج
انا ادرسه الحين بالجامعه هو حق اي مستوى

الرجل الغربي
19-02-2008, 12:05
thanks

سيرين
24-02-2008, 11:10
مرحبا من جديد

MexFX
شكرا عل تعقيبك عل الموضوع
وبالنسبه للامثله .. حتى انا عندي بعض الحلول .. بس مني متاكده من صحتهاا
ومش كلها محلوله ..
يعني لو تبغوني انزلها في المنتدى عادي مش مشكله انزلهاا
بس اتاكدو اول من حلهااا

بعدين عل حكايه اني احط شرح مبسط للموضوع .. ترى مايحتاج لانها برامج صغيره وتعتبر امثله مش برامج
حقيقيه
وكاتبها عنوانها قبل الكود

فقط ظللي الكود بعد وضعه في صندوق التحرير وأضغطي زر PHP الموجود على يسار رمز (شارب) #...
مافهمت كيف يعني ؟؟

سيرين
24-02-2008, 11:21
اختي
KSA girl
انت بتدرسيهاا ومنتي عارفه حق اي مستوى ؟؟
كيف تجي ؟؟

المهم انا حقولك عاده اول متسوى تخصص حاسب ياخدوو الماده هادي
وحسب النظام القديم كانو ياخدو المستوى الاول تخصص سي
والمستوى اللي بعده سي دبل بلس
مع انو ما يحتاج الموضوع لانهم كلهم زي بعض مع اختلافات جدا جدا بسيطه

الرجل الغربي
ولكم

MexFX
25-02-2008, 16:12
مرحبا من جديد

MexFX
شكرا عل تعقيبك عل الموضوع
وبالنسبه للامثله .. حتى انا عندي بعض الحلول .. بس مني متاكده من صحتهاا
ومش كلها محلوله ..
يعني لو تبغوني انزلها في المنتدى عادي مش مشكله انزلهاا
بس اتاكدو اول من حلهااا

بعدين عل حكايه اني احط شرح مبسط للموضوع .. ترى مايحتاج لانها برامج صغيره وتعتبر امثله مش برامج
حقيقيه
وكاتبها عنوانها قبل الكود


مافهمت كيف يعني ؟؟
مرحباً سيرين .....

حليت الأمثلة ذاك اليوم بس نسيت أجي وأحطها :p

هي موجودة في المرفقات .... ما ني متأكد من واحد منهم لني ما فهمت المطلوب صح :cool:

بالمناسبة , كتبتهم في بيئة GNU\Linux, يعني لو كنتي تستخدمين ويندوز... لا تفتحيهم بالمفكرة NotePad لأن كل ملف بيظهر على شكل سطر طويل , إفتحيهم بالدفتر Word Pad أو بمتصفح الإنترنت Internet Explorer



مافهمت كيف يعني ؟؟

قصدي , لما تحطي كود ++C في ردك , لا يظهر بشكل جيد , لكن إن ظللتيه وضغطي زر php
http://www.mexat.com/vb/attachment.php?attachmentid=397392&stc=1&d=1203955917
سيتم وضع أكواد ++C في مربع , وسيتم تلوينها كما حدث في ردي السابق



جاناه

سيرين
02-03-2008, 21:20
//Alphabet: Print the alphabet with for loop

#include <iostream>
void main()
{ char letter; //used to 'drive' the loop
for (letter='A'; letter<='Z'; letter++)
{ cout<<letter; //no \n, alphabet will be one line
} //for loop
cout<<"\n"; //go to a new line after printing alphabet
} //main


اها يعني كدااا

~MG~
23-03-2008, 16:21
بسم الله الرحمن الرحيم

الأخت سيرين

تسلمين على هذا الجهد والمثابرة وهذه الدروس

ولكن لغتي في السي 0 :مرتبك: والفيجوال بيسك ضعيفة:مرتبك: لأن أتعلم من نفسي وإن شاء

الله لمن ألتحق بالجامعة بطلع إبداعاتي:مكر:

وبطلب طلب

هل يوجد برنامج للغة c ++ أو سي مجاني وإذا فيه ياليت تحطين الرابط

وبالتوفيق

:)

كيكه
25-04-2008, 14:29
سيرين

:بكاء:

السلام عليكم و رحمه الله و بركاته

كيف الحال ان شاء الله ::جيد::

:rolleyes:

افتكر اول موضوع دخلته لك كان موضوع ترحيب بك

و هذا تاني موضوع ادخله لك

بصراحه موضوع تستحقي دعوه حلوه عليه

مرررره شكرا على مجهودك

انا مش بطاله مع البرمجه لكن اتسائل هل ممكن يجي يوم اصير بارعه فيها

يارب بفضل الله ثم بفضلك و فضل موضوعك اصير توب ::جيد::

شكرا لك الله يوفقك و يسهل لك دراستك و تتخرجي بأعلى المعدلات

في امان الله و توفيقه

sniper2009
08-05-2008, 09:51
مشكورين على هاذة البرامج
وان شاء الله نشواف برامج اقوى من هاذة

سيرين
27-05-2008, 11:02
مرحبا من جديد

ولكن لغتي في السي 0 والفيجوال بيسك ضعيفة لأن أتعلم من نفسي وإن شاء

الله لمن ألتحق بالجامعة بطلع إبداعاتي

كلنا كدا انا نجحت في الماده .. ودحين باخذ لغه برمجه تانيه
واحس روحي برضوو لسى ضعيفه فيهاااا ..
يعني لو احد طلب مني اكتب له برنامج اخذته من قبل
اومشابه لبرنامج سبقت لي دراسته ممكن اقدر

لكن لو كان مختلف كتير
اقوله والله ما اعرف
بعدين نصيحه لازم ما تتعتمد عل الاستاذ اللي حيدرسك في الجامعه
لانو 30 بالميه من الفهم حتاخذها من الاستاذ و70 بالميه بمجهودك انت

هل يوجد برنامج للغة c ++ أو سي مجاني وإذا فيه ياليت تحطين الرابط

شخصيا انا اشتريت السي دي من مركز المدينه ..
وما ادري لو كان متواجد مجاني في النت

تحياتي

سيرين
27-05-2008, 11:08
اختي كيكه
افتكر اول موضوع دخلته لك كان موضوع ترحيب بك

و هذا تاني موضوع ادخله لك


اول موضوع ترحيب فياا كان قبل 5 سنين :o

مرررره شكرا على مجهودك


العفو يا حلوه .. وان شاء الله اكوون قدرت اوصل وولو جزء بسيط من هدفي


انا مش بطاله مع البرمجه لكن اتسائل هل ممكن يجي يوم اصير بارعه فيها

اكيد الواحد شويه وشويه ويوصل للاحتراف . مش من يوم وليله


يارب بفضل الله ثم بفضلك و فضل موضوعك اصير توب


امين يارب ... الله يحقق كل امانيكي ..وترى البرنامج اعقد من كدا ...
موضوعي مجرد مقدامات وشويه مش برامج .. وانما امثله تساعد عل فهم المفاهيم الاساسيه االلي تتعلق باللغه


شكرا لك الله يوفقك و يسهل لك دراستك و تتخرجي بأعلى المعدلات

امين يارب الله يسمع منك .. والاهم اني اتخرج فاهمه الهرجه .. مو زي الاطرش في الزفه
المعدل مش كتير بيهمني

ومره شكرا

سيرين
27-05-2008, 11:09
مشكورين على هاذة البرامج
وان شاء الله نشواف برامج اقوى من هاذة

العفووووووووووو

hacker-ye
28-08-2008, 15:55
اختي الغالي مشاء الله عليك بس انا ابغا اتعلم السي بلس بلس من البدايه وياريت لو سمحتي دروس بالعربي


انا سجلت في كليه قسم تكنولوجيا معلومات It

mosami
09-10-2008, 23:00
بسم الله الرحمن الرحيم

اشكرك كثيرا كثيرا على تعبك في كتابة كل هذه البرامج لاجل الفائدة العامة

انا فاهمة كويس الي انتي فيه ...انا سويت مثلك مرة ...

بس في الجامعة نشرت بمركز التصوير برامج كتيرة مع حلها لما قرب وقت الامتحانات

وكانت بعض البرامج وظيفة لبعض المجموعات لكن ماحصل شي والحمدلله

لوووول هذا كان بعد اختباري في البرمجة ع طول لوووووول

الله يوفق الجميع ان شاء الله

سيرين
26-10-2008, 19:25
اختي الغالي مشاء الله عليك بس انا ابغا اتعلم السي بلس بلس من البدايه وياريت لو سمحتي دروس بالعربي


العفووو ..
تقريبا الامثله والدروس للمبتدئين .. لكن دارستي كانت انقلش
بس لو حصلت اي مرجع بالعربي
ما رح ابخل عليكي


اشكرك كثيرا كثيرا على تعبك في كتابة كل هذه البرامج لاجل الفائدة العامة

انا فاهمة كويس الي انتي فيه ...انا سويت مثلك مرة


الله يقدرنا
عل مساعده الناس ..

ويبلغنا اهدافنا وامالنا

والله يوفق الجميع لما يحب ويرضى

biologie100
02-11-2008, 05:41
قبل تعلم لغات البرمجة و لتصبح محترفا عليك بتعلم الخوارزميات اولا لان هذه الخوارزميات هي اساس لغات البرمجة سلام