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

This is a discussion on 4 coodingmaster &salem &every one who help me in my ass within the C Programming forums, part of the General Programming Boards category; thanx &this is the final programmes i promise 2 post it ass 2#1 # include<stdio.h> void addelement(int*x,int*size,int num){ int pos=*size; ...

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    14

    Thumbs up 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>
    void addelement(int*x,int*size,int num){
    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);
    addelement(x,&size, 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;
    }
    }


    show me the meaning

  2. #2
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    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.
    Away.

  3. #3
    Un Artiste Extraordinaire volk's Avatar
    Join Date
    Dec 2002
    Posts
    357
    4 coodingmaster &salem &every one who help me in my ass
    Even that made me laugh.

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>Even that made me laugh.
    Particularly the last few words
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  5. #5
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    Haha, Salem... helping the newbs in their ass now I see...
    I thought someone would pick up on that. Very funny.


Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21