Undefined error Reference to `print`

Asked

Viewed 343 times

0

Guys I’m making a code here and it’s giving 2 errors that are:

error: ld returned 1 exit status
undefined reference to `print`

I checked the code and found no error, which could be?

#include <stdio.h>

float medias[4][5];

int main(){

    int i;
    int j;

    for (i = 0; i <4; i++){
            for (j = 0; j < 5; j++){

                    medias[i][j] = 0;

}}

    void menu(void);
    void entrada(void);
    float calculo(float nota1,float nota2);
    void varrer(void);
    void mediaturma(void);

    int opcao = 0;

    menu();
    printf("\n");

    printf(" Escolha = ");
    scanf("%i", &opcao);
    switch (opcao){

        case 1:{
            entrada();
            printf("\n");
            printf(" entrada de dados cadastrada com sucesso! \n");
        }

        case 2:{
            varrer();
            print("\n");
            printf(" medias calculadas com sucesso! \n");
        }

        case 3:{
            mediaturma();
            printf("\n");
        }

        case 4:{
        }

        case 5:{

            printf("\n");
            printf(" saiu com sucesso \n!");
        }

    }

    printf(" ");
    system("pause");
    return 0;
}

void menu(void){

    printf("\n");
    printf("                                      MENU \n");
    printf(" 1 - entrada de dados \n");
    printf(" 2 - calcular Medias \n");
    printf(" 3 - calcular Media da turma \n");
    printf(" 4 - imprimir Matriz \n");
    printf(" 5 - sair \n");
}

void entrada(void){

    int i;
    int j;

    for (i = 0; i <4 ; i++);{
        for (j = 0; j <5 ; j++){

                if (i = 1){

                        printf(" digite o RA do aluno %i: ",j+1);
                        scanf("%f", &medias[i][j]);

                }

                if (i = 2){

                        printf(" digite a nota 1 do aluno %i: ",j+1);
                        scanf("%f", &medias[i][j]);

                }

                if (i = 3){

                        printf(" digite a nota 2 do aluno %i: ",j+1);
                        scanf("%f", &medias[i][j]);

                }


    }}
}

float calculo(float nota1,float nota2){

     float calc = 0;
     calc = ((nota1 + nota2) / 2);
     return calc;
}

void varrer(void){

     int j = 0;
     for (j = 0; j < 5; j++){

            medias[4][j] = calculo(medias[2][j],medias[3][j]);
     }
}

void mediaturma(void){

  float total = 0;
  float mediat = 0;
  int i = 0;

  for (i=0; i < 5; i++){

    total = (total + medias[4][i]);
  }

  mediat = total / 5;

  printf(" a media da turma eh de %f ", mediat);
}
  • It seems you forgot to import the required libs before the code. #include<stdio. h> and #include<stdlib. h>

  • are already included and q n appeared in the code ai msm so this giving the msms 2 errors

  • Is it the only mistake? Then it’s typo

  • has 2 errors checked all printf and n found nothing strange are Undefined Reference to 'print' and error: id returned 1 Exit status

1 answer

2


The error seems to be here:

case 2:{
    varrer();
    print("\n"); // <===================================== faltou um f no nome da função
    printf(" medias calculadas com sucesso! \n");
}
  • oh these went right through the vision vlw fera

Browser other questions tagged

You are not signed in. Login or sign up in order to post.