# 4 coodingmaster &salem &every one who help me in my ass

• 07-16-2003
itcs
4 coodingmaster &salem &every one who help me in my ass
thanx &this is the final programmes
i promise 2 post it

ass 2#1

# include<stdio.h>
int pos=*size;
for(int i=0;i<*size;i++)
if(*(x+i)>num)
{
pos=i;
break;
}
for(i=*size;i>pos;i--)
*(x+i)=*(x+(i-1));
*(x+pos)=num;
(*size)++;
}
void remove(int *x,int *size,int num)
{
int pos=* size ;
for(int i=0;i<*size;i++)
if(num==*(x+i))
{
pos=i;
break;
}
for(i=pos;i<(*size-1);i++)
*(x+i)=*(x+i+1);
(*size)--;
}
void findMax (int *x,int size,int *max)
{
for (int i=1; i<size; i++)
if (*(x+i) >* max)
*max = *(x+i);
}
void printarray(int*x,int *size)
{
printf("the array is \n:");
for (int i=0; i<*size; i++)
printf ("%d\n", *(x+i));
}

int main ()
{
int num1,x[90],size,num,max;

printf("Enter the size:");
scanf("%d",&size);
for(int i=0;i<size;i++)
{
printf("Enter the array:");
scanf("%d",&x[i]);
}

do
{
printf("Enter a choice:\n \t 0 \tadd anumber \n \t 1 \t remove a number frome list \n \t 2 \t print the array numbers \n \t 3 \t find maximum \n \t 4 \t end program\n");
scanf("%d",&num1);
if(num1==0){
printf("Enter the number :");

scanf("%d",&num);
}
else if(num1==1){
printf("Enter the number :");
scanf("%d",&num);
remove( x, &size, num);
}
else if(num1==2)
printarray(x,&size);
else if(num1==3){
findMax ( x,size,&max);
printf("the max is :%d\n",max);
}
else
printf("Envalid code");
}while(num1!=4);
return 0;
}

ass2#2
# include <stdio.h>
#define maxsize 10
void findMaxPos(int *, int , int ,int *,int *);

int main ()
{
int array [maxsize][maxsize];
int size,rawnum,colnum, colsize;

printf ("Enter the size of columns :\n");
scanf ("%d", & colsize);
printf ("Enter the size of raws :\n");
scanf ("%d", & size);
for (int i=0; i<size; i++)
for (int j=0; j< colsize; j++)
{
printf ("Enter the array:\n");

scanf ("%d", & array[i][j]);
}
rawnum=colnum=0;
findMaxPos(array[0],size,colsize,&rawnum,&colnum);
printf ("The max is %d in pos %d : %d",array[rawnum][colnum],rawnum,colnum);
return 0;
}
void findMaxPos(int *array, int size, int colsize,int *rawnum,int *colnum)
{
int max=*array;
for (int i=0;i<size;i++)
for (int j=0;j< colsize;j++)
if (*(array+i*maxsize+j)>max) {
max=*(array+i*maxsize+ j);
*rawnum=i;
*colnum=j;
}
}

:D :) :)
• 07-16-2003
confuted
Haha, Salem... helping the newbs in their ass now I see :) Sorry, couldn't help it.

itcs - type out assignment - don't abbreviate it ass.
• 07-16-2003
volk
Quote:

4 coodingmaster &salem &every one who help me in my ass
Even that made me laugh. :p
• 07-16-2003
Hammer