The document discusses possible reasons for errors in programming assignments, including runtime errors from issues like missing return statements, compile time errors from warnings, wrong answers due to incorrect logic or output formatting, presentation errors like missing newlines, and requests that students compile and check their code before submitting.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
35 views4 pages
Reasons For Error
The document discusses possible reasons for errors in programming assignments, including runtime errors from issues like missing return statements, compile time errors from warnings, wrong answers due to incorrect logic or output formatting, presentation errors like missing newlines, and requests that students compile and check their code before submitting.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4
Possible Reasons For Errors:
1. Runtime Error : a. using void main() instead of int main()
b. In int main() function not writing return 0;
This doesnt have return 0;
2. Compile Time Error :
Make sure you are not getting any warning in your program. Since it means you are writing a bad code and judge evaluates such code as Compile Time Error To Compile your program : To compile prog.c Write on terminal : gcc Wall prog.c o pg lm Or gcc Wall prog.c lm -Wall option in gcc helps to see if any warning is there or not Ex : Problem 1 : Exchange
Since if you declare long int it means give %ld format
specifier than %d. This warning you will see if you use Wall option while compiling 3. Wrong Answer : a. Your logic may be incorrect OR b. You are not matching the output format Ex :
In this code prompting user is not correct since it is not
matching the required Input Format. Also Output format is not correct since it is printing yes but it is expected YES so please read the Problem Description correctly with Input and Output Format. 4. Presentation Error: a. Missing newline in the end while printing Ex : Problem 1 : Exchange
Finally a Humble Request : Please submit your code after
compiling your program on your terminal. We are seeing lot of student they are not even compiling their program on their terminal and checking against the Sample Input given in Problem Description.
C++ Programming for Beginners: Get Started with a Multi-Paradigm Programming Language. Start Managing Data with Step-by-Step Instructions on How to Write Your First Program (2022 Guide for Newbies)