ParsX.com
پذیرش پروژه از دانشجویی ... تا سازمانی 09376225339
 
   ProfileProfile   Log in to check your private messagesLog in to check your private messages  |  FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups Log inLog in   RegisterRegister 

پروژ هاي دانشگاهي انجام شده

 
Post new topic   Reply to topic    ParsX.com Forum Index -> C/C++ Programming
View previous topic :: View next topic  
Author Message
elinaz
مهمون يكي دو روزه


Joined: 21 Nov 2007
Posts: 42
Location: تهران

PostPosted: Tue Dec 11, 2007 4:34 pm    Post subject: پروژ هاي دانشگاهي انجام شده Reply with quote

دوستان عزيز اين برنامه ها توسط آقاي مرتضي ظفري نوشته شده

خودشون اينها را در اينترنت قرار داده اند تا همه استفاده كنند

اميدوارم همه از ايشون ياد بگيرند و به جاي كمك معلم خصوصي به ديگران معرفي نكنند.

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

متاسفانه سايت اين آقا يادم نيست تا بهتون معرفي كنم



برنامه هایی از قبیل:
ساخت ماتریس همسازه از یک ماتریس وارد شده،
پیدا کردن تمام حالات مجموع دو عدد اولی که عدد دلخواه زوج را میسازند،
فاکتوریل یک عدد به کمک بازگشتی،
چند نوع مرتب سازی (نام و اعداد)




#include<math.h>
/*
   Written By: Morteza Zafari 2001
   This program calculates all possible combination of two
   prime numbers which produce a given even number.
*/

int IsPrime(int);  //returns 1 if prime.  returns 0 if not prime.

void main()
   {
   int i,r,num;
   clrscr();
   printf ("_____________________________________________________________\n");
   printf (" This program will calculate all possible combination of two\n prime numbers which produce a given even number. \n");
   printf ("_____________________________________________________________\n");
   printf ("\nPlease input an even number: ");
   scanf  ("%d",&num);    // Getting a number from the user.
   if (num%2 != 0)        // Checking if the given number is even or not.
      {
      printf("\n%d is not an even number",num);
      getch();
      return;  //Exit the program.
      }
   //---------- Start -----------//

   /*
       This program uses just one 'For' statement
       as we know 'A+(B-A)=B' so if 'A' AND '(B-A)'
       are prime numbers, they are the answer.
   */
   for (i=2;i<=(num/2);i++)
      {
      if ( IsPrime(i) && IsPrime(num-i) )
         {                // If BOTH of them are prime, Show them.
         printf ("\n %4d + %4d = %d ",i,(num-i),num);
         }
      }
   printf("\n\n Thanks for using this program.\n Morteza Zafari\n 2001");
   getch();
   }
   //---------- End -----------//

IsPrime(int num)
   {
   int i;
   if (num==1) return(0);    //If it's 1, it's not prime.
   if (num==2) return(1);    //If it's 2, it's prime.
   if (num%2==0) return(0);  //If it is even then sure it's not prime.
   else
      {
      for (i=2;i<=sqrt(num);i++)
   {
    if ( (num%i) == 0 ) return(0);
   }
   return(1);
      }
   }


--------------------------------------



#include <stdio.h>
#include <conio.h>
/* A program to calculate the Factorial for a given number.
           By Morteza Zafari                     */
long int fact(int);
void main()
   {
   int num;
   clrscr();
   printf(".:::: this program will calculate the Factorial for a given number ::::.");
   printf("\n\n  Please input a number to calculate the Factorial: ");
   scanf("%d",&num);
   if (num<0 ) printf("\n  Negative numbers don't have Factorial");
   else printf("\n  The Factorial for %d is %ld\n",num,fact(num));
   getch();
   }

long int fact (int n)
   {
   if (n!=0 && n!=1) return(n*fact(n-1));
   else return(1);
   }




----------------------------------------------------------------------------------------------


#include<stdio.h>
#include<conio.h>
#include<string.h>
#define N 5 //Number of names.
//   This program finds the first name in a given list of names (alfabeticaly)
//   Morteza Zafari 2001

void main()
{
   clrscr();
   char name[N][20],first_name[20];

   int i,j,c=0;
   printf("\n This program finds the first name in a given list of names (alfabeticaly).\n");
   for (i=0;i<N;i++){
      printf("\n Enter name No %d: ",i+1);
      gets(name[i]);
   }
   strcpy(first_name,name[0]);
   for (i=1;i<N;i++){
      if (strcmp(name[i],first_name)<0)
         strcpy(first_name,name[i]);
   }
   printf("\n First Name in the list is: ");
   puts(first_name);

   getch();
}



-----------------------------------------------------------------------------------------


#include<stdio.h>
#include<conio.h>

/*
   This program makes a new 3x3 matrix by removing one Row and
   one Column from the original 4x4 matrix
   BY: Morteza Zafari 2001.
*/

void main(){
   int i,j,mat[4][4],ham[3][3];
   textcolor(9);
   clrscr();
   printf(" ---------------------------------------------------------------");
   printf("\n This program makes a new 3x3 matrix by removing one Row and");
   printf("\n one Column from the original 4x4 matrix");
   printf("\n BY: Morteza Zafari 2001.\n");
   printf(" ---------------------------------------------------------------");
   getch();
   textcolor(1);
   clrscr();
   // Getting data from user, for a 4x4 matrix.
   for(i=0;i<4;i++){
      for(j=0;j<4;j++){
         mat[i][j]=j+i;
         printf(" Enter Row: %d, Col: %d: ",i+1,j+1);
         scanf ("%d",&mat[i][j]);
      }
      printf("\n");
   }

   // Asking the user which Row and Col to delete
   //printf("\n");
   int r,c;
   int row2del,col2del;

   printf(" Which Row and Col to delete? [1-4] \n");
   printf(" Row: ");
   scanf ("%d",&row2del);
   printf(" Col: ");
   scanf ("%d",&col2del);

   c=0;
   r=0;

   // Calculating the new 3x3 Matrix.
   for(i=0;i<4;i++){
      for(j=0;j<4;j++){
         if (i!=row2del-1 && j!=col2del-1){
            ham[r][c]=mat[i][j];
            c++;
         }
      }
      if(i!=row2del-1 && j!=col2del-1){
         r++;
         c=0;
      }
   }
   // Printing the old 4x4 Martix.
   clrscr();
   printf("\n\n");
   for(i=0;i<4;i++){
      printf("|");
      for(j=0;j<4;j++){
         printf(" %4d ",mat[i][j]);
      }
      printf("|\n");
   }
   printf("\n By deleting Row=%d and Col=%d of this matrix we will have: ",row2del,col2del);
   printf("\n\n");

   // Printing the new 3x3 Matrix.
   for(i=0;i<3;i++){
      printf("|");
      for(j=0;j<3;j++){
         printf(" %4d ",ham[i][j]);
      }
      printf("|\n");
   }

   getch();
}



--------------------------------------------------------------------------------------------

#include<stdio.h>
#include<conio.h>
#include<string.h>
#define N 5

//   This program sort a given list of name and scores by score.
//   Morteza Zafari 2001

void main()
{
   clrscr();
   char name[N][20],tmpstr[20];
   float score[N],tmpscr;
   int i,j,c=0;
   printf("\n This program sort a given list of name and scores by score.\n");
   for (i=0;i<N;i++){
      printf("\n Enter name No %d: ",i+1);
      gets(name[i]);
      printf("\n Enter name %s's score: ",name[i]);
      scanf("%f",score[i]);
   }
   for (i=0;i<N;i++){
      for (j=0;j<N;j++){
         if (score[c+1]<=score[c]){
            strcpy(tmpstr,name[c]);
            strcpy(name[c],name[c+1]);
            strcpy(name[c+1],tmpstr);
            tmpscr=score[c];
            score[c]=score[c+1];
            score[c+1]=tmpscr;
         }
         c++;
      }
      c=0;
   }
   for (i=0;i<N;i++){
      printf("\n Name No %d: ",i+1);
      puts(name[i]);
   }
   getch();
}


---------------------------------------------------------------------------------------------------


#include<stdio.h>
#include<conio.h>
#include<string.h>
#define N 5

//   This program sorts a given list of names (alfabeticaly)
//   Morteza Zafari 2001

void main()
{
   clrscr();
   char name[N][20],tmpstr[20];
   int i,j,c=0;
   printf("\n This program sorts a given list of names (alfabeticaly)\n");
   for (i=0;i<N;i++){
      printf("\n Enter name No %d: ",i+1);
      gets(name[i]);
   }
   for (i=0;i<N;i++){
      for (j=0;j<N;j++){
         if (strcmp(name[c+1],name[c])>0){
            strcpy(tmpstr,name[c]);
            strcpy(name[c],name[c+1]);
            strcpy(name[c+1],tmpstr);
         }
         c++;
      }
      c=0;
   }
   for (i=0;i<N;i++){
      printf("\n Name No %d: ",i+1);
      puts(name[i]);
   }
   getch();
}



---------------------------------------------------------------------------------------------------


صدها نفر براي بارش باران دعا كردند
غافل از آن كه خدا با كودكي است كه چكمه هايش سوراخ است
Back to top
vahid
بي تو هرگز


Joined: 26 Nov 2004
Posts: 3067
Location: Tehran

PostPosted: Wed Dec 12, 2007 5:34 pm    Post subject: Reply with quote

خانوم اليناز براي چپ چين شدن كد ها بايد توي اديتور كد رو انتخاب كنيد و دكمه code رو بزنيد .
تشرك از كدي كه گذاشتيد ، كاش يه معلم خصوصي به ما ياد مي داد اين كد چي كار مي كنه .
Back to top
elinaz
مهمون يكي دو روزه


Joined: 21 Nov 2007
Posts: 42
Location: تهران

PostPosted: Thu Dec 13, 2007 9:45 am    Post subject: !!!!! Reply with quote

ممنون از اينكه راهنماييم كرديد

از اينكه كدها به اون شكل نوشته مي شد خيلي نارحت بودم

راستي شما كه خودتون در معرفي معلم خصوصي استادين Wink
Back to top
Display posts from previous:   
Post new topic   Reply to topic    ParsX.com Forum Index -> C/C++ Programming All times are GMT + 3.5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum