[ create a new paste ] login | about

Link: http://codepad.org/qjNYMHuY    [ raw code | output | fork ]

C, pasted on Jan 27:
#define _CRT_SECURE_NO_WARNINGS


#include <time.h>
#include <math.h>
#include <malloc.h>

int main() {
    int n = 0, i, k = 0, B[10];
    for (i=0;i<10;i++){
        B[i]=rand()%30-10;
    }
    printf("Массив B:\n ");
    for (i=0;i<10;i++){
        printf("%d   ", B[i]);
    } 

    for (i = 0; i < 10; i++)
    {
        printf("%3.1d",B[i]);
        if (B[i]%2==0)
        {
            n++;
        }
    }
    int*Y = new int[n];
    for (i = 0; i < 20; i++)
    {
        if (B[i]%2==0)
        {
            C[k] = B[i];
            k++;
        }
    }
 
    int M=n; //количество элементов массива C

     printf("\n");
	 printf("\n Количество элементов массива C: M=");
     printf("%3.1d",M);
	 printf("\n");


    int Cmax=C[0], Imax; //нахождение макс элемента и его индекс
    printf("\n");
    for (i = 0; i < M; i++)
    {
	  If C[i]>Cmax Cmax=C[i];
	  Imax=I;
    }
    Printf(“Максимальный элемент массива С[%d]: %d\n, Imax, Cmax);
    

    Int F[4][M]; //инициализация массива F и его заполнение
    For (i=0;i<4;i++){
	For (j=0;j<M;j++){
	 F[i][j]= 2.2*B[i]*sinf(C[j]);
    }}
    
    For (i=0;i<4;i++){
	Printf(“\n);
	For (j=0;j<M;j++){
	  Printf(%d   , F[i][j]);
    }}
	
    Int S; //сумма элементов периметра матрицы
    for(i=0;i<4;i++)
    {
        printf("\n");
        for(j=0;j<M;j++)
        {
            if(i==0 || i==4-1)
              S+=F[i][j];
            else if(j==0 || j==M-1)
              S+=F[i][j];
         }
    }
     printf("\n\nСумма элементов на периметре матрицы F равна %d",S);


Output:
In function 'main':
Line 26: error: 'new' undeclared (first use in this function)
Line 26: error: (Each undeclared identifier is reported only once
Line 26: error: for each function it appears in.)
Line 26: error: expected ',' or ';' before 'int'
Line 31: error: 'C' undeclared (first use in this function)
Line 48: error: 'If' undeclared (first use in this function)
Line 48: error: expected ';' before 'C'
Line 49: error: 'I' undeclared (first use in this function)
Line 51: error: stray '\342' in program
Line 51: error: stray '\200' in program
Line 51: error: stray '\234' in program
Line 51: error: stray '\320' in program
Line 51: error: stray '\234' in program
Line 51: error: stray '\320' in program
Line 51: error: stray '\260' in program
Line 51: error: stray '\320' in program
Line 51: error: stray '\272' in program
Line 51: error: stray '\321' in program
Line 51: error: stray '\201' in program
Line 51: error: stray '\320' in program
Line 51: error: stray '\270' in program
Line 51: error: stray '\320' in program
Line 51: error: stray '\274' in program
Line 51: error: stray '\320' in program
Line 51: error: stray '\260' in program
Line 51: error: stray '\320' in program
Line 51: error: stray '\273' in program
Line 51: error: stray '\321' in program
Line 51: error: stray '\214' in program
Line 51: error: stray '\320' in program
Line 51: error: stray '\275' in program
Line 51: error: stray '\321' in program
Line 51: error: stray '\213' in program
Line 51: error: stray '\320' in program
Line 51: error: stray '\271' in program
Line 51: error: stray '\321' in program
Line 51: error: stray '\215' in program
Line 51: error: stray '\320' in program
Line 51: error: stray '\273' in program
Line 51: error: stray '\320' in program
Line 51: error: stray '\265' in program
Line 51: error: stray '\320' in program
Line 51: error: stray '\274' in program
Line 51: error: stray '\320' in program
Line 51: error: stray '\265' in program
Line 51: error: stray '\320' in program
Line 51: error: stray '\275' in program
Line 51: error: stray '\321' in program
Line 51: error: stray '\202' in program
Line 51: error: stray '\320' in program
Line 51: error: stray '\274' in program
Line 51: error: stray '\320' in program
Line 51: error: stray '\260' in program
Line 51: error: stray '\321' in program
Line 51: error: stray '\201' in program
Line 51: error: stray '\321' in program
Line 51: error: stray '\201' in program
Line 51: error: stray '\320' in program
Line 51: error: stray '\270' in program
Line 51: error: stray '\320' in program
Line 51: error: stray '\262' in program
Line 51: error: stray '\320' in program
Line 51: error: stray '\260' in program
Line 51: error: stray '\320' in program
Line 51: error: stray '\241' in program
Line 51: error: expected expression before '[' token
Line 51: error: expected ')' before ':' token
Line 51: error: stray '\' in program
Line 51: error: stray '\342' in program
Line 51: error: stray '\200' in program
Line 51: error: stray '\235' in program
Line 54: error: 'Int' undeclared (first use in this function)
Line 54: error: expected ';' before 'F'
Line 55: error: expected ')' before ';' token
Line 55: error: expected ';' before '{' token
Line 61: error: stray '\342' in program
Line 61: error: stray '\200' in program
Line 61: error: stray '\234' in program
Line 61: error: stray '\' in program
Line 61: error: stray '\342' in program
Line 61: error: stray '\200' in program
Line 61: error: stray '\235' in program
Line 63: error: stray '\342' in program
Line 63: error: stray '\200' in program
Line 63: error: stray '\234' in program
Line 63: error: stray '\342' in program
Line 63: error: stray '\200' in program
Line 63: error: stray '\235' in program
Line 70: error: 'j' undeclared (first use in this function)
Line 73: error: 'S' undeclared (first use in this function)
Line 73: error: 'F' undeclared (first use in this function)
Line 78: error: expected declaration or statement at end of input


Create a new paste based on this one


Comments: