• Register
1 vote


Learning programming is fun, but it becomes hectic alongside sometimes. I am a novice in C/C++ programming and I’ve written a program that should check student grade/mark but the program is not working for me. Please find my sample code snippet below and let me know where I am doing wrong.

#include <stdio.h>
int main (void){ 
    int num;    
    printf("Enter the number here :");
    scanf("%d",& num);
    switch (num){
    case 1:
        print("Grade 1");
    case 2:
        print("Grade 2");
    case 3:
        print("Grade 3");
        print ("Error");
    return 0;

Thanks for your kind concern guys.

12 7 7
15,250 points

Please log in or register to answer this question.

1 Answer

1 vote


Before posting the problem you should have a keen eye into your program again. Look into the Switch statement in your program. You tried to call a non-existent function print() from the library <stdio.h>

That’s the reason you are getting the error. Replace all the print() with the printf() and give it another try.

Keep discovering new things and asking. Thanks.

13 9 6
94,260 points

Related questions

0 votes
1 answer 98 views
Problem Hey, I Am facing an error at the time of compilation. Compiler says permission denied and Id returned to 1 exit status. Someone can help me resolve this error. That will be helpful for me. Here&rsquo;s my binary search algorithm code that I was trying to compile. Algorithm: #include <stdio.h>         ...          printf("Your value is not in the array.");                          }    } }
asked Dec 21, 2020 chris jordan 2.4k points
0 votes
1 answer 129 views
0 votes
1 answer 29 views
Problem: I am learning to use functions, in this case it asks me that the function receives parameters and does not return anything, but I got that error and I don't know why. The truth is I saw huge amounts of videos explaining how to do it, let's say it was "understood" and I tried to apply them, but ... } void sample2 (int l2 [], int size) { for (int i = 0; i <tam; i ++) cout << l2 [i] << ""; }
asked Dec 4, 2020 sasha 16.2k points
0 votes
1 answer 7 views
Problem: What will be the solution of the error:ld return 1 exit status?
asked Mar 26 ashik 14.6k points
0 votes
1 answer 34 views
0 votes
1 answer 204 views
Problem: The strftime() method returns a string representing date and time using date, time or datetime object.ou will to convert date, time and datetime objects to its equivalent string (with the help of examples).The datetime object containing current date and time is stored in now variable.
asked Jan 10 Mashhoodch 13k points
0 votes
1 answer 15 views
Problem: I am trying to solve this, and need help: Undefined reference to `winmain@16' collect2.exe: error: ld returned 1 exit status
asked Mar 14 Wafa Abu Yousef 6.1k points
0 votes
1 answer 1.7K views
Problem : I am trying to use the eclipse CDT to test my Intel instructions and following is my program: #define cpuid(func,jx,kx,lx,mx)\ __asm__ __volatile__ ("cpuid":\ "=j" (jx), "=k" (kx), "=l" (lx), "=m" (mx) : "j" (func)); ... +0xa7): undefined reference to `WinMain@16' collect2.exe: error: ld returned 1 exit status Please let me know if anybody have any solution regarding the above issue.
asked Dec 19, 2019 alecxe 7.5k points
0 votes
1 answer 3 views
Problem: Kindly tell me how to do it .. 1d returned 1 exit status c++
asked Apr 2 Ifra 25.7k points
0 votes
1 answer 19 views
Problem: I don't know how to fix it, if here anyone who know about this then please answer me. It's a request. I really want to fix this by which i can feel free from this problem.
asked Apr 3 niyatiry 3.6k points