<mosaic.cnfolio.com>
Introduction to Computing – B142L

B142L Feedback comments to students

Academic year 2011/12



Students have individual coursework pages in which they may write notes as they work on practical worksheets and the coursework assignment. They are encouraged to use the commenting feature to write questions as they work. The unit lecturer can post feedback using the same commenting feature. Comments written by each student is private.

The list below contains feedback comments written by the unit lecturer, but, without any student information. It is provided in case other students have similar questions.

Comment 311   by Moderator   @ 1970-01-01 00:00
The referral coursework demonstrated:
- minimal effort to develop algorithms for solving the coursework problem
- minimal effort to implement the required features
- minimal familiarity with C syntax
- minimal effort to implement a structured program
- minimal effort to practice the software development life cycle as indicated by the history of saved versions for the individual Mosaic coursework page
Comment 310   by Moderator   @ 1970-01-01 00:00
The referral coursework did not contain algorithms or source code.
Comment 309   by Moderator   @ 1970-01-01 00:00
The referral coursework demonstrated:
- minimal effort to develop algorithms for solving the coursework problem
- minimal effort to implement the required features
- minimal familiarity with C syntax
- minimal effort to implement a structured program
- minimal effort to practice the software development life cycle as indicated by the history of saved versions for the individual Mosaic coursework page
Comment 308   by Moderator   @ 1970-01-01 00:00
The referral coursework demonstrated:
- minimal effort to develop algorithms for solving the coursework problem
- minimal effort to implement the required features
- minimal familiarity with C syntax
- minimal effort to implement a structured program
- minimal effort to practice the software development life cycle as indicated by the history of saved versions for the individual Mosaic coursework page
Comment 307   by Moderator   @ 1970-01-01 00:00
The referral coursework demonstrated:
- minimal effort to develop algorithms for solving the coursework problem
- minimal effort to implement the required features
- minimal effort to practice the software development life cycle as indicated by the history of saved versions for the individual Mosaic coursework page
Comment 306   by Moderator   @ 1970-01-01 00:00
The referral coursework demonstrated:
- minimal effort to develop algorithms for solving the coursework problem
- minimal effort to implement the required features
- minimal familiarity with C syntax
- minimal effort to implement a structured program
- minimal effort to practice the software development life cycle as indicated by the history of saved versions for the individual Mosaic coursework page
Comment 305   by Moderator   @ 1970-01-01 00:00
The referral coursework demonstrated:
- minimal effort to develop algorithms for solving the coursework problem
- minimal effort to implement the required features
- minimal familiarity with C syntax
- minimal effort to implement a structured program
- minimal effort to practice the software development life cycle as indicated by the history of saved versions for the individual Mosaic coursework page
Comment 304   by Moderator   @ 1970-01-01 00:00
The referral coursework demonstrated:
- minimal effort to develop algorithms for solving the coursework problem
- minimal effort to implement the required features
- minimal familiarity with C syntax
- minimal effort to implement a structured program
- minimal effort to practice the software development life cycle as indicated by the history of saved versions for the individual Mosaic coursework page
Comment 303   by Moderator   @ 1970-01-01 00:00
The referral coursework demonstrated:
- minimal effort to develop algorithms for solving the coursework problem
- minimal effort to implement the required features
- minimal familiarity with C syntax
- minimal effort to practice the software development life cycle as indicated by the history of saved versions for the individual Mosaic coursework page
Comment 302   by Moderator   @ 1970-01-01 00:00
Overall, you met the threshold requirements as written in the coursework marking rubrics. The comments below are areas that you might consider for future improvements.

Line 24 and the if statements (such as lines 43, 50, 55, etc.) are ineffective for error detection. For example, the return value from scanf() would have provided the exact number of matched input values.

The duplication of the source code for invert (starting at line 38) and normal (starting at line 230) could have been more effective. Using less source code is easier to read for maintenance reasons, but, may also slightly improve performance.

The usage of the variables a, b and c are critical to the correct display of your program. But, there were few comments about them (e.g. lines 36 and 219-221). That does not indicate how much you understand about the importance of those variables. For example, how do they affect the scalability and maintenance of the program?

The names of the variables were more for convenience (such as i, a, b or c) than for readability and maintenance. Imagine if you come back to the program 6 months later and had to add support for more characters or a new background. It would take extra time to make sense of the short variable names.

The history of saved versions shows that most of the work was done over 4-6 days, much of it near the due date. It would have been better to obtain earlier feedback during labs to improve the coursework.
Comment 301   by Moderator   @ 1970-01-01 00:00
In order to explain your source code and the comments on your coursework page, please meet me at lecture on Thursday or at your lab session on Friday at 1pm. Alternatively, you may also attend one of the other lab sessions on Thursday 3pm or Friday 9am. THIS IS A REQUIRED MEETING.

If you do NOT meet to explain the source code, then, I will take your action to mean that you did NOT write the current program and that you will be attempting to write and submit a different coursework program during the late submission period.
Comment 300   by Moderator   @ 1970-01-01 00:00
You did not start use your coursework page until April 10 and then did not put much effort in until April 26. The program contains a number of syntax errors. Please come to lecture and labs this week so we can discuss the coursework.
Comment 299   by Moderator   @ 1970-01-01 00:00
Lines 13, 19, 23 and 27 have incorrect syntax. That may cause side-effects and create follow on problems. Each simple statement must end with a semicolon. Compound statements are one or more simple statements enclosed inside a pair of braces. Do NOT use a comma to separate multiple simple statements.
Comment 298   by Moderator   @ 1970-01-01 00:00
C is procedural and sequential. The test conditions on line 10 come before the test conditions on line 15. Although it compiles, there is a logical error because a perfect cube where all sides are equal will ALWAYS test true at line 10 and NEVER reaches line 15. You can fix the logical error by performing the tests for the perfect square BEFORE the less restrictive tests for a square cuboid, i.e. switch the tests in line 10 with the tests in line 15.
Comment 297   by Moderator   @ 1970-01-01 00:00
The syntax for test conditions are correct in line 10, but, incorrect in line 15. Look at the differences. Once the syntax is correct, then, check that the logic matches the pseudo code. For example, the OR logic in line 10 does not match the pseudo code on line 29.

Working through this now will help both your coursework and your exam.
Comment 296   by Moderator   @ 1970-01-01 00:00
Feedback does not mean that I can declare whether there are bugs or not in your program. That is testing and it is the responsibility of each student. I can briefly try various features, but, THAT IS NOT THE SAME AS MARKING YOUR COURSEWORK. I did try some of the basic test values and it appears to work normally with your program. That is the most I can say as feedback. If I try to say more, then, it would be the same as marking your coursework, then, you fixing the errors, then marking it again, repeating, etc. The functionalities of your program looks like it is on the right track, but, testing and debugging before the final submission is still your responsibility. To be fair and consistent, coursework is marked once and at the same time for all students.
Comment 295   by Moderator   @ 1970-01-01 00:00
The extra clock image is not a problem, but, the ascii art is a bit scary!
Comment 294   by Moderator   @ 1970-01-01 00:00
The history of saved versions has positive and negative points. Positively, it shows development of the coursework during Mar 13-23. Negatively, it does not show much testing and there are very little extra information to help show the development of the algorithms used in your final solution on Mar 23. For example, there are few source code comments and no tags/notes with the saved versions. For example, how did you decide the sequence of steps to work on? How did you decide to use polygon corners as the elements to store in the grid arrays? The steps and the arrays are not problems, but, what led you to those steps and that particular method of using polygon corners in the arrays?

Concrete improvements would be a test plan and testing as discussed in the lecture notes, and, more comments to explain the motivation and concepts leading to the final algorithm design in your program.
Comment 293   by Moderator   @ 1970-01-01 00:00
The user instructions at the start of the program is informative and useful. It helps the user to see the extra features that you've added to your program.
Comment 292   by Moderator   @ 1970-01-01 00:00
The coursework has the specific requirement that the program "Correctly process input values from zero to 9999". That is what the user provides as input. Each student can decide how they want to read the input into their program, which means that it's OK if you choose to read in a string as input. In a similar manner, the coursework suggests a size for the output LED, but does not require one size, so, your choice of 550 x 400 is OK. Using the Ming library is a positive extra for your coursework.
Comment 291   by Moderator   @ 1970-01-01 00:00
The variable assignments on lines 16, 23 and 27 are incorrect - they need to be complex statements enclosed inside braces. Please read the notes and look at the examples for 'simple' vs. 'complex' statements and for the different types of control structures using the if/else syntax.
Comment 290   by Moderator   @ 1970-01-01 00:00
You copied your coursework in semester 1. You put it very little effort in semester 1, with some saved versions in October, none in November, a few in December and then at the last minute in January before the due date. It is even worse in semester 2. You did not touch your coursework 2 page until April 4. Then, in ONE saved version, you claim to submit a draft for coursework 2. First, that means you FAILED to meet the coursework marking criteria, "earnest attempts to practice the software development life cycle as indicated by the history of saved versions for the individual Mosaic coursework page". Second, the complete lack of practice at learning and practicing the graphics library functions makes it difficult to understand how you managed to write a solution for coursework 2 in only ONE saved version. I expect to see you in your next scheduled lab session, Friday 9am, so that you can explain the source code. If you do NOT come to lab to explain, then, I will take it to mean that your current version was copied and that you will be attempting to write and submit a different coursework program.
Comment 289   by Moderator   @ 1970-01-01 00:00
The error is that the program logic is not flexible. Line 15 requires that the first digit must ALWAYS represent the thousand position. But, when there is only 2 digits of input, the first digit only represents the TENS position. To fix it, your logic has to be flexible enough to handle different positions depending on how many input digits were found.

The current program would not meet the coursework requirement because it does not correctly handle small numbers. So, the logic error must be fixed.
Comment 288   by Moderator   @ 1970-01-01 00:00
When a number is shown, it depends on position. 234 is equivalent to (2*100) + (3*10) + (4*1) = 234. The position is matched to its corresponding power of 10. At line 13, you need to do something similar to calculate the total from the individual input digits.
Comment 287   by Moderator   @ 1970-01-01 00:00
Animation effects can be created using either the GD library to create GIF animated images or the Ming library to create Flash movies. Links to the reference documentation for both libraries are available on the unit website.
Comment 286   by Moderator   @ 1970-01-01 00:00
The scanf() at line 12 uses up the input values. So, when it gets to the scanf() at line 41, the input used at line 12 is not available to be read again. You have to save the input value from line 12 and re-use it later when you decide that the input is valid.
Comment 285   by Moderator   @ 1970-01-01 00:00
It is a serious concern that the first time you've touched your coursework page is April 4. I do not know what you've been doing during the second semester so far. Apparently, you were not in lectures or labs. During the lectures and labs, I repeated a number of times that students can use their source code and algorithms from the first coursework. But, there are additional requirements for the second coursework. Please come to lectures and labs to ask questions.
Comment 284   by Moderator   @ 1970-01-01 00:00
If an image or movie is created, then, the compiler will display that as the output.

If no image or movie is found, then, it will display the stdout text.

Therefore, if you want to display an error message in stdout, then, do not generate an image. That means your error detection has to occur BEFORE generating the image. Using this approach, the program only generates an image if the input values are correct. Otherwise, it displays an error message and does not generate an image.

Alternatively, you can generate a symbol in the image to indicate an error, something like a stop sign or a warning sign. Using this approach, the program generates a different image for correct input values and a different image for incorrect input values.

You can decide which approach to use, but, please make sure your algorithm is documented in the coursework.
Comment 283   by Moderator   @ 1970-01-01 00:00
Reply to comment 9: What do you mean "more than 9999" and what error message are you expecting? What is your test plan? Do you understand the solution provided for coursework 1?
Comment 282   by Moderator   @ 1970-01-01 00:00
In the future, please read and use the study resources provided on the unit website. It is important that you learn how to use technical reference materials. The direct link to the page about using arrays with functions is http://cnfolio.com/public/summit/sx10f.html
Comment 281   by Moderator   @ 1970-01-01 00:00
Please see me in lab because the source code is incorrectly using arrays as function parameters.
Comment 280   by Moderator   @ 1970-01-01 00:00
Great work with the ming animation!
Comment 279   by Moderator   @ 1970-01-01 00:00
Line 24 has errors. You are reading one integer, but, trying to assign the values to an array of integers. So, you can either change the method of reading input values or change how you assign the input to each element of the array. Please read the lecture notes for examples or ask me in lab.
Comment 278   by Moderator   @ 1970-01-01 00:00
The most common way for the loop to stop is when the test condition fails. However, you can also immediately exit a loop by using the keyword 'break'. Please look at the lecture notes for an example.
Comment 277   by Moderator   @ 1970-01-01 00:00
Look carefully at the calculation on line 34. When your input is 1, the calculation is 1/1000, which is very small. When that small value is converted to an integer number, the fraction is dropped and becomes zero.
Comment 276   by Moderator   @ 1970-01-01 00:00
The source code has errors in the initialisation of array elements. Please do the worksheets and ask in lab if you have trouble with arrays or if you do not understand the solution for coursework 1.
Comment 275   by Moderator   @ 1970-01-01 00:00
Reply to comment 2: Please see me in lab if you still have questions about the coursework 1 solutions and how it works.
Comment 274   by Moderator   @ 1970-01-01 00:00
Reply to comment 2: It looks like you've fixed the syntax error with the if statement at line 28 of revision 23. Try to see if you can use a loop or function to reduce the length of the source code.
Comment 273   by Moderator   @ 1970-01-01 00:00
Reply to comment 2: It looks like you've fixed the syntax for the switch statements. Try to see if you can use a loop to help you reduce the length of the program.
Comment 272   by Moderator   @ 1970-01-01 00:00
Please ask questions in lab or lecture if you're having trouble with arrays.
Comment 271   by Moderator   @ 1970-01-01 00:00
Reply to comment 5: How do you know that the program is not running the first loop? The logic of using the variable 'no' and the array values may be more likely as the cause of the program errors.
Comment 270   by Moderator   @ 1970-01-01 00:00
Reply to comment 3: You can reduce the risk of an infinite loop by having a more narrow or restricted set of values for the test condition. For example, revision 9 is expecting one input float, so, your test condition could be limited to just ( number == 1 ).
Comment 269   by Moderator   @ 1970-01-01 00:00
Worksheet 19 requires a loop to iterate through each character in the input string. Revision 12 does not solve the problem because it does not have a loop.
Comment 268   by Moderator   @ 1970-01-01 00:00
What happened? You've not been working on your coursework since Feb 16.
Comment 267   by Moderator   @ 1970-01-01 00:00
It appears that getline() may not be supported on the FreeBSD (which is the operating system of the Mosaic server). Please try a different function.
Comment 266   by Moderator   @ 1970-01-01 00:00
Is there a reason you need to use dynamic memory allocation? The outcome is the same as allocating a string of size equal to InputLimit + 1.
Comment 265   by Moderator   @ 1970-01-01 00:00
The message indicates that there is an error in your program.
Comment 264   by Moderator   @ 1970-01-01 00:00
Line 12 and your switch statements are using the variable, program, which has not been assigned a value.
Comment 263   by Moderator   @ 1970-01-01 00:00
Lines 7 and 10 are using integer variables. The if statements are using character data types in the test conditions. Those are 2 different data types.
Comment 262   by Moderator   @ 1970-01-01 00:00
That means that you or another student wrote a program that had a forever loop. It is a temporary problem for a minute or 2. Then, you can compile again once the server cleans up the program that caused the problem.
Comment 261   by Moderator   @ 1970-01-01 00:00
Working in small steps will help you debug the cause of that error.
Comment 260   by Moderator   @ 1970-01-01 00:00
That means that you or another student wrote a program that had a forever loop. It is a temporary problem for a minute or 2. Then, you can compile again once the server cleans up the program that caused the problem.
Comment 259   by Moderator   @ 1970-01-01 00:00
I've sent an email.
Comment 258   by Moderator   @ 1970-01-01 00:00
I received your email this afternoon, Saturday, January 14. The coursework due date is January 15. This was announced in the first week of the semester. It is not a surprise. I warned you the few times I saw you in lab that you MUST DO MORE WORK. You ignored my advice. You did some work in October and November and for ONE DAY (Dec 5) as the semester ended in December. There were plenty of opportunities to do the work and ask for help during the semester. Now, it is the examination period and there are no lectures or labs for any unit. Since the semester ended, you have worked 5 days on the coursework: Dec 22, Dec 24, Dec 25, Dec 28 and Jan 14. That is no substitute for hard work during an entire semester. I hope you will make a decision to put more effort into your studies during semester 2 to avoid the problems that you've created for yourself through your irresponsible decisions in semester 1. The only suggestion I have on a Saturday one day before the due date is to submit something to avoid a non-submission penalty.
Comment 257   by Moderator   @ 1970-01-01 00:00
Read the comments I've written to other students ( http://mosaic.cnfolio.com/B142LCW2011Comments ). The main requirement is that the algorithm has to generate output for one line at a time for ALL 4 digits, then, move on to the next line below, etc. In Revision 64, the program is generating ALL 5 LINES for ONE digit, then, moving on to the next DIGIT, which is the reason the output is vertical (one digit on top of the next). The current Revision 65, is closer to the approach needed to display horizontally.
Comment 256   by Moderator   @ 1970-01-01 00:00
The explanations need a lot of improvement. For example, which part of the program is most important, are they all the same importance? Which choices were available for implementing the solution and why did you choose the current program as the solution? Is the algorithm for the solution easy to read? Does the algorithm map clearly to the source code? Which choices affect the program performance? Which choices affect the portability of the program to be used for similar solutions or with different environments?
Comment 255   by Moderator   @ 1970-01-01 00:00
The link to the list of all feedback comments is on Mosaic and the B142L unit website. If you still can't find it at those locations, then, the direct link is here: http://mosaic.cnfolio.com/B142LCW2011Comments
Comment 254   by Moderator   @ 1970-01-01 00:00
There is no technical restriction on the size of a program.
Comment 253   by Moderator   @ 1970-01-01 00:00
Logical errors are mistakes which compile because the syntax is correct, but, do not create the desired result. Look more closely at the format codes you are using with scanf(). How would the compiler meet your request? Is it possible? Look at the worksheets where it asks you to practice looking at the differences in different format code templates.
Comment 252   by Moderator   @ 1970-01-01 00:00
Your choice of scanf() format codes is the main restriction on whether the program can handle the required input. It makes a difference which format codes and which data types you decide to use for the input. Look at the examples in the worksheets and the notes. Currently, your program is asking for ONE input number, then, manually trying to separate out the digits. Think about whether you can use scanf() or other input functions to do that work for you. Think about whether you can use different data types for the input and how that might remove the need for you to manually separate out the digits.
Comment 251   by Moderator   @ 1970-01-01 00:00
The coursework requirements and options are described on the coursework page, including the marking criteria. Additionally, I've written a number of feedback comments about other aspects of the coursework requirements. Read the list of all feedback comments. The link in available on the unit website and on Mosaic.
Comment 250   by Moderator   @ 1970-01-01 00:00
I've addressed this issue a number of times in lectures, labs and in feedback comments. Please read the list of all feedback comments. The link is on the unit website and on Mosaic.
Comment 249   by Moderator   @ 1970-01-01 00:00
Do NOT use the GOTO statement. That is not structured programming. You have done very little work in October, nothing at all in November and one day in December. Suddenly, in January, a few days before the coursework due date, you start using the GOTO statement. The fact that you are trying to use the GOTO statement indicates that you do not attend lectures, labs, read the worksheets, read the lecture notes or read the study resources provided on the unit website. I hope you will decide to put a lot more effort into your studies in semester 2.
Comment 248   by Moderator   @ 1970-01-01 00:00
Look at the example output provided with the coursework assignment. Try using printf() to produce that specific output. No need for switch or loops. That will give you an idea of what is needed to produce the output for ONE SPECIFIC EXAMPLE. Because you will only use printf() functions, the code may be longer and may look repetitive. That's OK. The purpose is to see an example of solving one specific problem, then, you can use that to think about how to solve SIMILAR problems, i.e. other numbers. Your current program does not indicate that you have actually solved the problem. Solve the problem before trying to code it.
Comment 247   by Moderator   @ 1970-01-01 00:00
The syntax for switch and case statements are incorrect. The syntax of scanf() is correct, but, it is not likely to produce the behaviour required for the coursework. Try testing it to see if it works as required for the coursework.
Comment 246   by Moderator   @ 1970-01-01 00:00
You have made the decisions to do little work in October and no work at all during November and December. A meeting now would not help you. If it was possible to teach C programming in one meeting, then, there would be no need to have an entire unit on the subject. The only suggestion I have is that you start putting in effort towards your studies. Read the lecture notes. Do the worksheets. Submit something for the coursework to avoid a non-submission penalty. In semester 2, come to lectures and labs instead of waiting until the last minute.
Comment 245   by Moderator   @ 1970-01-01 00:00
Look at the example provided on the coursework assignment. Try using just printf() to emulate that example output. That will give you an idea of the approach that would be required to display horizontally. Then, you need to develop an algorithm to solve the problem. After that, then, work on writing the source code.
Comment 244   by Moderator   @ 1970-01-01 00:00
If you submit the current program, it will be charged with PLAGIARISM. I have evidence from the other student. PLAGIARISM IS A SERIOUS ACADEMIC OFFENSE WHICH IS ADDED TO YOUR STUDENT RECORD. It is your decision whether to do start over and do your own work or not. I will not comment on this issue again. This is the FINAL WARNING.
Comment 243   by Moderator   @ 1970-01-01 00:00
Reply to comment 9: It is not an acceptable reason that you decided not to do your work on Mosaic. The requirement to use your Mosaic coursework page has been repeated from the first week of lecture and in nearly every lecture, lab and worksheet.
Comment 242   by Moderator   @ 1970-01-01 00:00
Thanks. I have given the final warning to the other students. It is now their responsibility to start over or not.
Comment 241   by Moderator   @ 1970-01-01 00:00
If you submit the current program, it will be charged with PLAGIARISM. I have evidence from the other student. PLAGIARISM IS A SERIOUS ACADEMIC OFFENSE WHICH IS ADDED TO YOUR STUDENT RECORD. It is your decision whether to do start over and do your own work or not. I will not comment on this issue again. This is the FINAL WARNING.
Comment 240   by Moderator   @ 1970-01-01 00:00
Yes, it is possible to read one character of input at a time. But, you would need to think about how to still display the output horizontally instead of vertically.
Comment 239   by Moderator   @ 1970-01-01 00:00
Two students have the same source code as you. They claimed to have received help from you. Copying source code is not help - IT IS PLAGIARISM. I encourage students to help other students - but, help through explanations and debugging - not through plagiarism. Once the coursework has been submitted - then, ALL submissions which have been copied will be charged with PLAGIARISM.
Comment 238   by Moderator   @ 1970-01-01 00:00
Your coursework program is extremely similar to another student. The current saved version puts you at very high risk of being charged with PLAGIARISM. If it is indeed your own work, then, you should take steps to make sure you can explain EVERY line of code. If there is ANY CODE THAT IS NOT YOUR OWN, then, you should remove it and try writing your own code.
Comment 237   by Moderator   @ 1970-01-01 00:00
Your coursework program is extremely similar to another student. The current saved version puts you at very high risk of being charged with PLAGIARISM. If it is indeed your own work, then, you should take steps to make sure you can explain EVERY line of code. If there is ANY CODE THAT IS NOT YOUR OWN, then, you should remove it and try writing your own code.
Comment 236   by Moderator   @ 1970-01-01 00:00
You did very little work in October. There was one saved version of your coursework page in November and none in December. Today, you jumped straight to writing a program for the coursework which uses a custom function (a topic not covered in semester 1). That is a large improvement in programming skill. I hope it can be explained.
Comment 235   by Moderator   @ 1970-01-01 00:00
There was one saved version of your coursework page in November and none in December. Today, you jumped straight to writing a program for the coursework which uses a custom function (a topic not covered in semester 1). That is a large improvement in programming skill. I hope it can be explained.
Comment 234   by Moderator   @ 1970-01-01 00:00
It is not a surprise that you will find the coursework difficult if you have only done a little work in October and no work at all during November and December. The only suggestion I have is that you start putting in effort towards your studies. Read the lecture notes. Do the worksheets. Submit something for the coursework to avoid a non-submission penalty. In semester 2, come to lectures and labs.
Comment 233   by Moderator   @ 1970-01-01 00:00
Look at the list of comments I wrote to all students. I have provided suggestions multiple times about displaying the output.
Comment 232   by Moderator   @ 1970-01-01 00:00
There are no labs during the exam period. Contact me via email and I will setup an online meeting.
Comment 231   by Moderator   @ 1970-01-01 00:00
There is no explanation in the source code as to why you are trying to use sprintf() or strcat(). The main problem appears to be that there is no algorithm to solve the coursework problem. Without an algorithm to solve the problem, it will not be possible to implement the solution in code. Focus first on developing the solution. Then, implement the solution in small incremental steps.
Comment 230   by Moderator   @ 1970-01-01 00:00
The peer review will only allow view of the source code without editing or compiling access. Students will have to make a judgment by reading the source code, which is similar to the requirement for the end of unit exam.
Comment 229   by Moderator   @ 1970-01-01 00:00
Line 11 has correct syntax, but, it is asking for 5 numbers separated by spaces. That is incorrect because the coursework assignment requires the program to process 4 digits of input without any spaces between them. Line 12 has incorrect syntax. Line 16 has incorrect syntax because there the if statement is missing a test condition. The program does not indicate the algorithm that you intend to use to solve the problem.
Comment 228   by Moderator   @ 1970-01-01 00:00
Printing across rather than down can be implemented using a variety of syntax, including switch statements. But, it is more important to have an algorithm for the solution (how to print across). Then, choose syntax to implement that algorithm.
Comment 227   by Moderator   @ 1970-01-01 00:00
When there is no input, it is not clear what values will be in the input variables because they have not been initialised with any values. The safe way to do it is to either detect whether an input was found (then use the variables) or to initialise the variables with an unused value (such as -1) and that will make the switch case statements to all be false and no output.
Comment 226   by Moderator   @ 1970-01-01 00:00
Line 18 is using scanf() with the %c format code. That means that the variable to hold the input must be a character data type. If the variable is an integer data type, then, it is an error.
Comment 225   by Moderator   @ 1970-01-01 00:00
Function prototypes (lines 53-57) are required and good practice.
Comment 224   by Moderator   @ 1970-01-01 00:00
There are errors with the format codes on line 14. It is not clear what you are trying to achieve with lines 114, 117, 120 and 123. But, that may not generate the output you want. Lines 20 to 109 which declare a new variable for each switch case may have correct syntax, but, it is bad technique to declare a new array in every switch case. Instead, it is better to declare the array once, then, assign different values with each case statement.
Comment 223   by Moderator   @ 1970-01-01 00:00
It is possible to solve the coursework using 1, 2 or 3 dimensional arrays. Lines 7 to 11 declares a one dimensional array, but, the initialisation data is for a 2 dimensional array. Using multi-dimensional arrays usually require the use of multiple iterative loops. The unit website contains a link to a free C book. The direct link to the part on multi-dimensional arrays is http://cnfolio.com/public/summit/sx4ba.html
Comment 222   by Moderator   @ 1970-01-01 00:00
Printing across rather than down requires you to change the algorithm for generating the output. The algorithm must work across the first row of all 4 digits first, then, work across the second row of all 4 digits, etc.
Comment 221   by Moderator   @ 1970-01-01 00:00
The use of the switch statement itself does not affect other functions, such as printf() or fputs().
Comment 220   by Moderator   @ 1970-01-01 00:00
Please note that line 473 is chained only to the if statement on line 471. That will not perform error checking. If you want to use a chained decision structure, then, you need to change the algorithm or the code.
Comment 219   by Moderator   @ 1970-01-01 00:00
The printf() function does not have line spacing control. When we use the graphics libraries, there will be more choices for graphical output.
Comment 218   by Moderator   @ 1970-01-01 00:00
Line 13 and the test condition on line 14 is incorrect because it does not test whether an input was found or not. Declare a new variable, for example, int matches; Then use it like this: matches = scanf( "%c", &candy ); What happens now is that the value in the variables matches will be either zero or 1. It will be zero if the input did not contain a character. It will be 1 if the input did contain a character. You can use an if/else statement to detect the error condition, similar to what you are trying to do with lines 14 to 17.
Comment 217   by Moderator   @ 1970-01-01 00:00
Students may choose to use an array or not - it is possible to solve the coursework either way.
Comment 216   by Moderator   @ 1970-01-01 00:00
Lines 13-16 are declaring integer variables. But, line 18 is using scanf() and the format codes for character variables - which is incorrect because the data types do not match.
Comment 215   by Moderator   @ 1970-01-01 00:00
Students can choose how to handle leading spaces in the input to the coursework program. So, the input value 56 can be displayed with or without the two leading spaces or zeroes.
Comment 214   by Moderator   @ 1970-01-01 00:00
The coursework requirement is that the program must process input values from zero to 9999. It is optional to process upper or/and lowercase letters. If attempting the optional features, the student can choose the range of letters for the program to process. The program must provide an error message whenever an input value is received which is not supported by the program. The text of the error message is decided by the student.
Comment 213   by Moderator   @ 1970-01-01 00:00
That is a starting point, but, you need to read the documentation links on the worksheet and look closer. In particular, you need to understand why lines 11 and 14 have the same functional behaviour and the lines 8 and 17,18 have the same functional behaviour.
Comment 212   by Moderator   @ 1970-01-01 00:00
For the coursework, it is equally valid to have spaces or not between each output digit, i.e. there is no penalty for either choice. It is a design choice to make the output look nicer. The example on the coursework assignment page shows a single column of spaces between each output digit.
Comment 211   by Moderator   @ 1970-01-01 00:00
Reply to comment 28: Revision 72 contains a function definition, which is incorrect and should be removed. It is not necessary for Worksheet 13.
Comment 210   by Moderator   @ 1970-01-01 00:00
Reply to comments 26 and 27: The error is that the test conditions were making comparisons to characters - but, did not enclose the characters inside of single quotes. To fix the error, place the characters in single quotes, for example: if ( selection == 'e' )
Comment 209   by Moderator   @ 1970-01-01 00:00
The output can be made using any character, so, a the digit zero or the letter 'O' is valid to use. We will use a more advanced graphics library in semester 2.
Comment 208   by Moderator   @ 1970-01-01 00:00
Look at how to change your program so that it prints row by row instead of digit by digit. For example, row 1 for all 4 digits, then, row 2 for all 4 digits, etc.
Comment 207   by Moderator   @ 1970-01-01 00:00
The main change is to print row by row instead of digit by digit. For example, row 1 for all 4 digits, then, row 2 for all 4 digits, etc.
Comment 206   by Moderator   @ 1970-01-01 00:00
Declare a new variable, for example, int matches; Then use it like this: matches = scanf( "%c", &candy ); What happens now is that the value in the variables matches will be either zero or 1. It will be zero if the input did not contain a character. It will be 1 if the input did contain a character. You can use an if/else statement to detect the error condition.
Comment 205   by Moderator   @ 1970-01-01 00:00
You can delete the current code and write your coursework. Nothing is lost because all previously saved versions are available. The final saved version on the due date is considered to be your coursework submission.
Comment 204   by Moderator   @ 1970-01-01 00:00
Declare a new variable, for example, int matches; Then use it like this: matches = scanf( "%c", &candy ); What happens now is that the value in the variables matches will be either zero or 1. It will be zero if the input did not contain a character. It will be 1 if the input did contain a character. You can use an if/else statement to detect the error condition.
Comment 203   by Moderator   @ 1970-01-01 00:00
The problem in revision 92 was that the code was incorrectly using the single equal sign to make comparisons; the correct equality comparison operator is the double equal sign.
Comment 202   by Moderator   @ 1970-01-01 00:00
Looks like revision 63 is correctly using the output of scanf() to check input values.
Comment 201   by Moderator   @ 1970-01-01 00:00
The problem with line 20 of revision 31 was that the variable name was in lowercase when it was declared in uppercase.
Comment 200   by Moderator   @ 1970-01-01 00:00
When using multiple test conditions, remember to use parentheses to separate each test condition.
Comment 199   by Moderator   @ 1970-01-01 00:00
Do NOT include your name or student ID number with your coursework.
Comment 198   by Moderator   @ 1970-01-01 00:00
Line 67 is declaring the variable "input" to be a pointer to a string - no memory is allocated. That causes a problem for line 84, because that statement is expecting the variable "input" to be a character data type - which it is not. In turn, that causes problems for lines 89, 90 and 92.
Comment 197   by Moderator   @ 1970-01-01 00:00
Prioritise the variables. That will reduce the number of test conditions. For example, if the year is not 2007, is it necessary to compare the month or date?
Comment 196   by Moderator   @ 1970-01-01 00:00
Reply to comment 6: Lines 20, 27, 34 and 41 are invalid C syntax.
Comment 195   by Moderator   @ 1970-01-01 00:00
Reply to comment 5: In revision 23, it appears that you are using the semicolon (;) on lines 26, 29 and 32 to comment out the code. That is incorrect. Semicolons are used to terminate a code statement. Comments are have a start and end indicator. Look at examples on lines 5 and 7. The calculate the amount of pennies, you need to multiply the variables for each quantity of coin with the value of each coin. For example, if you have 4 coins that are worth 5p each, then, the total amount in pennies is 4 x 5 = 20 pennies. That is worth 20 / 100 = 0.20 pounds. You expand these calculations to include all the coins in the worksheet.
Comment 194   by Moderator   @ 1970-01-01 00:00
Nov 28 is the first time you used your coursework page since the academic year started. It will require a great deal of effort to catch up on the missed work.
Comment 193   by Moderator   @ 1970-01-01 00:00
The emphasis is that you understand that line 9 is the same as lines 17 and 18 combined, and that line 11 is the same as line 14.
Comment 192   by Moderator   @ 1970-01-01 00:00
The emphasis is that you understand that line 9 is the same as lines 18 and 19 combined, and that line 12 is the same as line 15.
Comment 191   by Moderator   @ 1970-01-01 00:00
Good use of the switch statement.
Comment 190   by Moderator   @ 1970-01-01 00:00
The problem to fix is that each if statement is printing all 7 lines of output at once. That is why each number appears below each other rather than across. You want one line printed for all 4 numbers, then, repeat and print the next line for all 4 numbers and repeat until line 7 is printed for all 4 numbers. For that, you will need to modify the if statements and use a loop. The error detection using line 10 is incorrect.
Comment 189   by Moderator   @ 1970-01-01 00:00
Reply to comment 16: The use of strcat() is incorrect. The loop starting at line 65 is not adding up the population. Is there a reason you decided to use arrays and strings? They were not required to do the worksheet.
Comment 188   by Moderator   @ 1970-01-01 00:00
Reply to comment 13: You can optimise by combining and removing if statements that use the same logic tests. One way to do that is to decide which variable is more important for logic comparisons and use the order to reduce the logic tests. For example, if the year is incorrect, is it necessary to test the month and date?
Comment 187   by Moderator   @ 1970-01-01 00:00
Good progress. The problem to fix is that each case statement in each switch statement is still printing all 5 lines of output at once. That is why each number appears below each other rather than across. You want one line printed for all 4 numbers, then, repeat and print the next line for all 4 numbers and repeat until line 5 is printed for all 4 numbers. For that, you will need to modify the switch and case statements, plus use a loop.
Comment 186   by Moderator   @ 1970-01-01 00:00
Reply to comment 40: Revision 76 has a logic error at line 18, which means that line 24 is not reached and nothing is printed.
Comment 185   by Moderator   @ 1970-01-01 00:00
Response to comments 9-11: That is the correct approach. Solve the problem first. Only try to optimise after you have a working solution. In this case, you can optimise by combining the if statements at lines 36 and 42 (in Revision 39). For example, the new test condition could be: else if ( ( w == h ) || ( h == l ) )
Comment 184   by Moderator   @ 1970-01-01 00:00
Reply to comment 33: Let me know if you have more questions since we had discussed this in lab.
Comment 183   by Moderator   @ 1970-01-01 00:00
The value of nocandy variable would be zero if there was no input and 1 if a character was found. That is the reason line 8 is incorrect.
Comment 182   by Moderator   @ 1970-01-01 00:00
The coursework assignment specify that the program must correctly process one input integer of value zero to 9999. That means it would be incorrect if the program requires a space between each input digit.
Comment 181   by Moderator   @ 1970-01-01 00:00
Good work on the coursework! Can you use a loop to reduce the number of switch statements?
Comment 180   by Moderator   @ 1970-01-01 00:00
Declare a new variable, for example, int matches; Then use it on line 6 like this: matches = scanf( "%c", &candy ); What happens now is that the value in the variables matches will be either zero or 1. It will be zero if the input did not contain a character. It will be 1 if the input did contain a character. You can use an if/else statement to detect the error condition.
Comment 179   by Moderator   @ 1970-01-01 00:00
The general idea is good. Consider printing from left to right before going top to bottom.
Comment 178   by Moderator   @ 1970-01-01 00:00
Where is your code for worksheet 15? The sample code in comment 24 is incorrect because you are not using a variable. It is worrying that you are at worksheet 15 and do not know how to use a variable. Please make sure you thoroughly understand the previous worksheets, especially worksheet 4.
Comment 177   by Moderator   @ 1970-01-01 00:00
Declare a new variable, for example, int matches; Then use it on line 6 like this: matches = scanf( "%d", &num1 ); What happens now is that the value in the variables matches will be either zero or 1. It will be zero if the input did not contain a number. It will be 1 if the input did contain a number. You can use an if/else statement to detect the error condition.
Comment 176   by Moderator   @ 1970-01-01 00:00
Line 16 is missing a semicolon at the end of the line.
Comment 175   by Moderator   @ 1970-01-01 00:00
Line 24 has an error. The printf() function does not contain the names of the variables to be printed.
Comment 174   by Moderator   @ 1970-01-01 00:00
For simple values, there is not much of a performance difference. It is better to define pi as a variable or a constant to make it easier to maintain the program. In unusual situations, mostly in scientific programming, when large values (e.g. the number of atoms in the universe) are used frequently, it is better to use a specific data type that would be most efficient for storing that type of value.
Comment 173   by Moderator   @ 1970-01-01 00:00
Reply to comments 16 and 17: Good work to make the calculations in the program. Can you change it so that the input comes from the stdin so that you can type different values at run time?
Comment 172   by Moderator   @ 1970-01-01 00:00
The loop (lines 42-47) is currently set to run only if the switch statement reaches case 10. For all other cases, the program does not reach the loop code. To fix the program, change so that the switch statement is inside the body of the loop. Use the switch statement to find the population of one city. Then, use the loop to repeat that task for each input number.
Comment 171   by Moderator   @ 1970-01-01 00:00
One task in worksheet 15 is to take an input number, then decide which city it matches and find its population. The loop, such as the for statement, is used to repeat that task 5 times, once for each input number.
Comment 170   by Moderator   @ 1970-01-01 00:00
The program is using 2 chained decisions. Lines 12-23 is one chained decision structure. Lines 25-36 is another chained decision structure. Your input values, 2007 7 9
, do not match any of the test conditions in lines 12-23, so nothing is printed. You can fix the program by changing the test conditions in lines 12-23.
Comment 169   by Moderator   @ 1970-01-01 00:00
Your program is trying to use a chained decision. The error is that the if statements are not chained together. Look at the lecture notes http://cnfolio.com/IntroToComputingTopic04p09 to fix the syntax for chained if statements.
Comment 168   by Moderator   @ 1970-01-01 00:00
Line 17 is not used by your program. Is that intentional?
Comment 167   by Moderator   @ 1970-01-01 00:00
Reply to comment 20: The format codes are the only difference in between lines 11 and 12 in Revision 22. Think about why that difference demonstrates that characters are stored as integers.
Comment 166   by Moderator   @ 1970-01-01 00:00
The format codes in lines 35 and 38 are incorrect. That is the reason the output are not displayed correctly.
Comment 165   by Moderator   @ 1970-01-01 00:00
It is a big worry that you've only used your coursework page starting on Nov 13. It is important for you to put in a lot of extra work to catch up on the previous 7 weeks.
Comment 164   by Moderator   @ 1970-01-01 00:00
There are different ways to handle the input. You could treat it as 4 characters. You could treat it as 1 number with 4 digits, which would require you to use modulus math to separate the 4 digits. You could read 4 characters, then, convert the characters to numbers.
Comment 163   by Moderator   @ 1970-01-01 00:00
Reply to comment 6: Revision 29 uses a constant definition for pi, which is good. You may also treat it as a variable and give it a name and a value.
Comment 162   by Moderator   @ 1970-01-01 00:00
Reply to comment 5: You specify the precision of the output. For example, %.3f indicates 3 decimal places of precision. The reference links in the worksheet 6 has more information.
Comment 161   by Moderator   @ 1970-01-01 00:00
Reply to comment 29: Assign the return value of scanf() to a variable. For example, int matches; matches = scanf(); Then, you can compare the variable to see if user input was found or not. For example, if you're expecting one user input, then no input was found if the variable is equal to zero. The reference documentation in the worksheet has more information.
Comment 160   by Moderator   @ 1970-01-01 00:00
Reply to comments 27 and 28: Good work to fix the problem. Can you find a way to use a loop so that only one switch statement is required?
Comment 159   by Moderator   @ 1970-01-01 00:00
Good work. Look for areas that you can use loops to reduce the duplicate code in the program.
Comment 158   by Moderator   @ 1970-01-01 00:00
Reply to comment 34: As we discussed in lab, be careful of 2 issues. First, the format code must match the data type when using printf() and scanf(). Second, when using multiplication or division operations, make sure that at least one of the operands is a floating point data type.
Comment 157   by Moderator   @ 1970-01-01 00:00
Using case 0 may work for very specific cases, but, it is not a good idea because the program would still not able to identify missing input. It is better to use the return value from scanf().
Comment 156   by Moderator   @ 1970-01-01 00:00
The test conditions in lines 9 and 12 are incorrect. There should be single quotes around the character a in the test condition. In C, a character constant is indicated by a single quote around it. So, the character a is written as 'a' and when the single quotes are not present, the program considers it to be the name of a variable.
Comment 155   by Moderator   @ 1970-01-01 00:00
Look at line 7. The scanf() function provides a result after it finishes to say how many input values it found. Look at this reference link http://cnfolio.com/public/libc/Formatted-Input-Functions.html and this lecture note http://cnfolio.com/IntroToComputingTopic05p17
Comment 154   by Moderator   @ 1970-01-01 00:00
Instead of printing all rows for each digit. Try printing one row for each digit, then, moving on to the next row. Repeating until all rows have been printed.
Comment 153   by Moderator   @ 1970-01-01 00:00
On line 12 of Revision 115, the error is in the test condition. The scanf() function was asking for 1 input, so, the test condition should be similar to, scanf() == 1.
Comment 152   by Moderator   @ 1970-01-01 00:00
That is a good approach to improve the maintenance of the program. There is another way which could both improve the maintenance of the program and save you the extra calculation. Define the volume formulas as a constant, using the #define preprocessor directive, then the formulas are at the top of the program for easy maintenance as well as easy usage inside the if/else statements. There is more information at this reference link http://www.acm.uiuc.edu/webmonkeys/book/c_guide/1.7.html#define
Comment 151   by Moderator   @ 1970-01-01 00:00
Reply to comments 11-13: You need to add code to perform a math operation. The sample program in worksheet 4 displays the number of bytes in memory used for a data type. If 2 bytes is equal to 1 word, then, which math operation is required? Then, you decide where in the program to put the math operation. It can be done at the time of printing or at the time of calling the sizeof() keyword.
Comment 150   by Moderator   @ 1970-01-01 00:00
Reply to comment 9: Floating point data types generally use more memory than integer data types. Check worksheet 4.
Comment 149   by Moderator   @ 1970-01-01 00:00
Reply to comment 78: Declare multiple variables with a comma between each name. For example int number1, number2;
Comment 148   by Moderator   @ 1970-01-01 00:00
Reply to comments 74 and 75: Good work to fix the error.
Comment 147   by Moderator   @ 1970-01-01 00:00
Reply to comment 73: Test the calculations by hand (use a dry run table). Use parentheses to make the calculations easier to read and maintain.
Comment 146   by Moderator   @ 1970-01-01 00:00
Reply to comment 72: The idea is possible, but, I think you meant %4s rather than %s4
Comment 145   by Moderator   @ 1970-01-01 00:00
Let me know if you have questions after our discussion about scanf() in lab today.
Comment 144   by Moderator   @ 1970-01-01 00:00
Reply to comment 17: Good work to fix Revision 36.
Comment 143   by Moderator   @ 1970-01-01 00:00
Based on our discussion in lab, please ask questions if any parts of the worksheets or coursework is not clear.
Comment 142   by Moderator   @ 1970-01-01 00:00
Worksheet 9 is asking you to test and observe the impact of white spaces on the input. Read the reference pages and compare that to your observations of the output.
Comment 141   by Moderator   @ 1970-01-01 00:00
Reply to comment 12 and 13: Start worksheet 8 by declaring variables and calculating the volume of a cube. Then, add another shape afterwards.
Comment 140   by Moderator   @ 1970-01-01 00:00
Reply to comment 31: Good work in Revision 44 to change the order of the test conditions to implement the correct output.
Comment 139   by Moderator   @ 1970-01-01 00:00
Reply to comment 29: Which runtime error are your referring to in Revision 40?
Comment 138   by Moderator   @ 1970-01-01 00:00
Reply to comment 28: Those observations are correct. In addition to those observations, what did you notice about the data type after the math operation was done?
Comment 137   by Moderator   @ 1970-01-01 00:00
Revision 48 is correct. Can you produce the same output using the not equal comparison operator?
Comment 136   by Moderator   @ 1970-01-01 00:00
The declarations and initialisations are correct, but, the parentheses are not required around the name of the variables. In line 20, ask yourself, how would I calculate the amount of money represented by these coins? If you have 5 five-pence coins, that is equivalent to 25 pence. In C, that is 5 * fivep. That multiplication is repeated for each type of coin. The sum of all the multiplication products is the total amount of money in pence.
Comment 135   by Moderator   @ 1970-01-01 00:00
In C, a character constant is indicated by a single quote around it. So, the character a is written as 'a' and when the single quotes are not present, the program considers it to be the name of a variable.
Comment 134   by Moderator   @ 1970-01-01 00:00
Revision 41 looks correct. Line 25 is good, but, it may be easier to read if you add parentheses around the multiplication operations.
Comment 133   by Moderator   @ 1970-01-01 00:00
In the current revision, lines 18 and 22 have errors. I'd suggest that you finish up the previous worksheets, e.g. 4, 5 and 6 before working on worksheet 7. You've worked on your Mosaic coursework page 1 day in October and 1 day in November. That lack of effort makes it difficult to learn.
Comment 132   by Moderator   @ 1970-01-01 00:00
Reply to comment 4: You need to add code to perform a math operation. The program in Revision 5 displays the number of bytes in memory used for a data type. If 2 bytes is equal to 1 word, then, which math operation is required? Then, you decide where in the program to put the math operation. It can be done at the time of printing or at the time of calling the sizeof() keyword.
Comment 131   by Moderator   @ 1970-01-01 00:00
In Revision 37, look at lines 21 and 54. The program can be reduced by combining test conditions.
Comment 130   by Moderator   @ 1970-01-01 00:00
Reply to comments 6 and 7: There is no need to write it out to a separate word document. If you want to write something, then write notes using a pen or pencil. Otherwise, write it as comments in your coursework page or source code.
Comment 129   by Moderator   @ 1970-01-01 00:00
Reply to comment 5: Line 11 does show that a character is stored as a number, but, line 10 does not. Which line other than 10 would be better to show that a character is stored as a number?
Comment 128   by Moderator   @ 1970-01-01 00:00
Reply to comment 4: The unit website contains links to additional study resources, including a free online book. The best way to learn is to read, practice the worksheets and ask questions. The history of saved versions for your coursework page indicates that you've not done much practice with the worksheets.
Comment 127   by Moderator   @ 1970-01-01 00:00
Worksheet 6 is not about correct or incorrect code. The first sample program is showing the limits associated with the floating point data types. The second sample program is showing the automatic data type conversion when using math operations. Run the programs, read the reference information and look at the output to make sure that you understand how the program generates the output. Look at the first sample program and the links to the reference documents to compare the usage of %lf and %LF
Comment 126   by Moderator   @ 1970-01-01 00:00
Reply to comment 30: The pseudo code is correct. As a design choice, do you want to calculate the volume twice? Could the algorithm be simpler by moving the volume calculation step to be part of the if / else decision?
Comment 125   by Moderator   @ 1970-01-01 00:00
Reply to comment 29: You can ask questions about the coursework or the worksheets. A basic error message is better than none. But, if you can provide more information with the error message, then, it is better for the user.
Comment 124   by Moderator   @ 1970-01-01 00:00
Reply to comment 28: You can combine the test conditions. For example, lines 19 and 33 in Revision 38 could be combined.
Comment 123   by Moderator   @ 1970-01-01 00:00
Reply to comment 26: That's very good! One of the goals of the unit is to encourage students to read and use technical documentation.
Comment 122   by Moderator   @ 1970-01-01 00:00
Try testing with one invalid character over and over until you can determine how the program is handling it. Then, test a different invalid character. Multiple invalid characters at once makes debugging more difficult.
Comment 121   by Moderator   @ 1970-01-01 00:00
Reply to comment 61, 62 and 63: You're thinking about the right questions for the coursework. It is possible to ask for multiple input values in one scanf() call. Look at the sample program in worksheet 9. The choice of processing one input digit at a time or processing all input digits is important for your coursework solution.
Comment 120   by Moderator   @ 1970-01-01 00:00
Reply to comments 35, 36 and 37: Do not focus only on the format code. Instead, focus on the data type expected from the math operation. In the worksheet, the math operation is addition. But, you should consider the data type expected from each math operation you use in a program.
Comment 119   by Moderator   @ 1970-01-01 00:00
Reply to comment 34: Use the scrollbar when the output is too wide.
Comment 118   by Moderator   @ 1970-01-01 00:00
Reply to comment 32: The use of constants, such as INT_MAX allows each compiler to specify the max values permitted based on the amount of memory it is allocating on that hardware. For example, an personal computer has less memory restrictions than a microprocessor embedded in a handheld device. So, the compiler on the personal computer can choose to allocated more memory for an integer and the compiler for an embedded microprocessor can allocate less memory. That causes the constant INT_MAX to have different values on each hardware platform. During the labs, you are looking at the values for a compiler on a muti-core server, so the values are very large.
Comment 117   by Moderator   @ 1970-01-01 00:00
Reply to comment 26 and 27: The program is exceeding the maximum limit permitted for each data type. This has an effect of "wrapping around" to the lowest available negative value because it is a signed data type. This is similar to moving from 'Z' to 'A' when you reach the end of the alphabet and "wrapping around" to the beginning of the alphabet.
Comment 116   by Moderator   @ 1970-01-01 00:00
Reply to comment 23: It is conventional practice to include stdio.h because it contains commonly used functions.
Comment 115   by Moderator   @ 1970-01-01 00:00
You have the right idea for test conditions. Look at the notes about how to use the logic operators (and/or) to use the test conditions together.
Comment 114   by Moderator   @ 1970-01-01 00:00
The Wikipedia article has "Five furlongs are approximately 1 kilometre (1.0058 km is a closer approximation)". Based on that, divide 1.0058 by 5 to calculate the km per furlong. Put that value in line 6 to fix the logic error in the practice program.
Comment 113   by Moderator   @ 1970-01-01 00:00
Possible solutions to worksheet 15 involve using a loop to handle the input numbers. Then, inside the loop, use a decision structure (if/else or switch), to select a city based on the input choice. The population total is calculated as the last step of the loop body.
Comment 112   by Moderator   @ 1970-01-01 00:00
Reply to comment 22: The scanf() function returns the number of matches found. For example, if ( scanf( "%d %d", &n1, &n2 ) == 2 ) is one way to write test condition which is only true when there is 2 input numbers. Otherwise, the test condition is false.
Comment 111   by Moderator   @ 1970-01-01 00:00
Reply to comment 29: Your observations are mostly correct. The choice of data type and spaces in the input formats control how the input is automatically converted by the program. Read this page http://cnfolio.com/public/libc/Input-Conversion-Syntax.html (especially the second paragraph) and use that to consider the reasons that cause the output.
Comment 110   by Moderator   @ 1970-01-01 00:00
Reply to comment 28: The errors are in lines 13 and 16 of Revision 50. Compare the usage of the scanf() and printf() functions to see what is missing in your scanf() statements (read http://cnfolio.com/IntroToComputingTopic03p02 ).
Comment 109   by Moderator   @ 1970-01-01 00:00
Observing the error is the first step. Next, look at the text in the worksheet and the output of the program to determine the source of the syntax error. Then, fix the error.
Comment 108   by Moderator   @ 1970-01-01 00:00
The errors are in lines 22 and 26. The first input parameter to the printf() function is a template of text to display. Do not write C code in that first input parameter, which is usually a text string. Instead move your calculations out after the text string. Read the examples in the lectures notes for Topic 3. Specifically, this page, http://cnfolio.com/IntroToComputingTopic03p06
Comment 107   by Moderator   @ 1970-01-01 00:00
Reply to comment 19: The test conditions in line 13 of Revision 47 are incorrect. You are using one equal sign, which means the assignment operator. What you need in a test condition is the equality comparison operator, which are 2 consecutive equal signs.
Comment 106   by Moderator   @ 1970-01-01 00:00
Reply to comment 14: The program is exceeding the maximum limit permitted for each data type. This has an effect of "wrapping around" to the lowest available negative value because it is a signed data type. This is similar to moving from 'Z' to 'A' when you reach the end of the alphabet and "wrapping around" to the beginning of the alphabet.
Comment 105   by Moderator   @ 1970-01-01 00:00
The switch statement does not allow test conditions. Use the if / else statements with test conditions. To handle no input, you need to read the link on the worksheet that describes the return value from using the scanf() function.
Comment 104   by Moderator   @ 1970-01-01 00:00
Consider the reasons that may cause the output in Comment 19.
Comment 103   by Moderator   @ 1970-01-01 00:00
The return statements indicates the end of the function. It is conventional practice to return the number zero when the program ends normally. If there was an error during the program execution, then, the conventional practice is to return a non-zero number.
Comment 102   by Moderator   @ 1970-01-01 00:00
Revision 48 is the correct idea for the coursework :)
Comment 101   by Moderator   @ 1970-01-01 00:00
Reply to comment 12: Look at the lecture notes about comparison and logic operators. The operators are Revision 22 is incorrect.
Comment 100   by Moderator   @ 1970-01-01 00:00
Reply to comment 11: The printf() statements in Revision 20 are different. Please look more carefully and try with different input values.
Comment 99   by Moderator   @ 1970-01-01 00:00
Reply to comment 2: The formula is from the article in Wikipedia. To fix the program, read the article and find the correct formula. Use the formula to fix line 6 in revision 14. There is no scanf() because there was no need to obtain input values.
Comment 98   by Moderator   @ 1970-01-01 00:00
That is a good starting point. Line 6 is correct. The error in lines 8, 10, 12, 14, 16, 18 and 20 is that variable names must not have spaces. Notice how the variable name in line 6 has no spaces. Change your variable names and you can go to the next step to add the math calculations.
Comment 97   by Moderator   @ 1970-01-01 00:00
The saved versions and comments do not show that you have done the previous worksheets. Please go through all the previous worksheets to make sure you understand every worksheet before moving on to the next one. For example, the scanf() function is incorrect because the format code does not match the data type of the variables. That was covered in the previous worksheets. The math calculations on line 19 is incorrect because there are no operators. That was also covered in the previous worksheets. Please work through the worksheets at your own pace to make sure you understand each worksheet.
Comment 96   by Moderator   @ 1970-01-01 00:00
Reply to comment 8: The minus sign indicates that the value "wrapped around" from the highest possible positive value to the lowest possible negative value. It is similar to going from 'Z' to 'A' when you reach the end of the alphabet.
Comment 95   by Moderator   @ 1970-01-01 00:00
Reply to comment 3: Your program was asking for 2 integers, and typing A and B were considered to be characters, so that means the program did not receive any valid input. That caused the output to be a nonsense value. You can fix that by initializing the variables to zero or by entering numbers in the stdin.
Comment 94   by Moderator   @ 1970-01-01 00:00
On line 26, the division operation is using 2 integer numbers, so the output is an integer, which is why it shows 7 is instead of 7.28 as you expect. Look at the notes where it describes that division operations require at least one of the operands to be a floating point. To fix line 26, think about how to change one of the operands into an floating point. For example, changing 100 to 100.0 would make it a floating point.
Comment 93   by Moderator   @ 1970-01-01 00:00
There is no interactive keyboard input. All the input must be typed into the blue panel before compiling and running the program. The blue panel is used as the stdin when the program runs and the stdout is displayed in the gray panel. It is different than compiling a standalone program on a personal computer. It is more convenient for students who are new to programming because they can focus only on learning the language without having to download, install and configure their own development environment.
Comment 92   by Moderator   @ 1970-01-01 00:00
Make sure you understand why the output is different.
Comment 91   by Moderator   @ 1970-01-01 00:00
Reply to comment 20: It is a logic error because the program does not have the code to handle invalid input. In a few worksheets later, you will learn how to detect whether the scanf() function was successful or not and how many matches it was able to find in the input. That step will allow you to write programs that can handle invalid input data.
Comment 90   by Moderator   @ 1970-01-01 00:00
Reply to comment 18: If scanf() is not successful, it leaves the input untouched. In this case, it is unsuccessful until the last attempt to read a character, which is valid.
Comment 89   by Moderator   @ 1970-01-01 00:00
Reply to comment 17: That observation is correct.
Comment 88   by Moderator   @ 1970-01-01 00:00
Reply to comment 16: You answered your own question in comment 15. When using the format template, "%d%c", without any spaces, the scanf() function does not throw anything out. So, it uses the space which would otherwise be used to separate the number inputs.
Comment 87   by Moderator   @ 1970-01-01 00:00
Compare the format code to the data type expected from the addition operator. If they match, then it will print correctly. If they do not match, then it will print a strange nonsense value. Make the comparison for each line from 10 to 15. Look at the notes where it describes how the C compiler temporarily upgrades a data type when performing math operations with operands that have different data types.
Comment 86   by Moderator   @ 1970-01-01 00:00
Reply to comment 5: Look at the notes about the ASCII table. That table determines which number represents which character.
Comment 85   by Moderator   @ 1970-01-01 00:00
If you are working on your B101 coursework, then you should be using the pages assigned for B101. Those pages are intended for writing articles and will look a lot better than writing articles in a compiler.
Comment 84   by Moderator   @ 1970-01-01 00:00
Good improvisation!
Comment 83   by Moderator   @ 1970-01-01 00:00
Reply to comments 10, 11 and 12: Define pi as you would any other variable. Declare a data type, give it a name and initialize it with a value. The compiler is expecting a function when you use pi(). That is the reason for the error.
Comment 82   by Moderator   @ 1970-01-01 00:00
Reply to comment 9: Revision 22 looks good for integers. Can you modify it to handle floating point values?
Comment 81   by Moderator   @ 1970-01-01 00:00
Reply to comment 10: The main() function is not correctly defined. Compare your program to the sample programs and other programs you've already saved. Look at the location of the opening and closing curly braces. The opening brace represents the start of the main() function body and the closing curly brace represents the end of the function body. They are missing in your program.
Comment 80   by Moderator   @ 1970-01-01 00:00
Reply to comment 9: Line 4 initialized the variable to zero. Line 5 took your input value, which was 29, and stored it to the variable. This had the effect of writing over the previous value of zero. Then, line 6 printed out the current value in the variable, which was 29.
Comment 79   by Moderator   @ 1970-01-01 00:00
Reply to comment 8: The return keyword marks the end of a function. In the case of the main() function, it is conventional practice to return an integer value to indicate whether the program finished successfully or not. A zero value indicates normal end of program. If a program ends due to errors, then, a non-zero value would be returned to indicate an error.
Comment 78   by Moderator   @ 1970-01-01 00:00
Reply to comment 6: The result did not make sense because the program was expecting 2 input numbers, but, you did not enter any input, so, the program just printed random values in memory. Try running the program with 2 input values and it should print those out.
Comment 77   by Moderator   @ 1970-01-01 00:00
Reply to comment 3: You have the right idea, but, the factor is incorrect. 5 furlongs = 1.0058 km , that means you need to perform an extra division operation to find 1 furlong = ? km
Comment 76   by Moderator   @ 1970-01-01 00:00
When declaring the variables on lines 5 to 10, why do you use the division operation? If you do want to use the division operation, is the int data type appropriate? Which would be a better data type to store the value from dividing 2 numbers? Lines 11 and 12 is the right idea, but, it would be more flexible if the addition was performed using the variables you declared above in lines 5 to 10.
Comment 75   by Moderator   @ 1970-01-01 00:00
Reply to comment 19: read the error message from the compiler. It points you to line 47. Look at the variables you are using with the printf() functions. You will notice that one of the variable names is different than the list of variables declared at the start of the program. Compare the printf() functions to the sample programs in the previous worksheets. You will notice that the data type should not be included with the printf() functions. Remove the int data types and change the variable name to fix the errors.
Comment 74   by Moderator   @ 1970-01-01 00:00
For worksheet 8 programs, go back and check that you've properly handled decimal floating point numbers when using the division operator. When using the division operator, at least one of the operands must be a floating point data type in order for the result of the division to be a floating point.
Comment 73   by Moderator   @ 1970-01-01 00:00
Worksheet 7 uses the work you've done in worksheet 4, 5 and 6. Look carefully at the comments in the program outline provided with worksheet 7. Compare those comments to the comments in worksheet 4. They should be very similar. The extra step in worksheet 7 is to perform two math calculations. Worksheet 7 also checks that you are learning to write a small program entirely on your own. Try these steps and let me know when you have more questions.
Comment 72   by Moderator   @ 1970-01-01 00:00
The placeholder format must match the data type of the data variable. Some of the statements in the source code are correct, and some are incorrect because they have mismatched format codes. Consider the data type of each number before the addition operation and the data type expected after the addition is done. Then, check if the format code matches or not. If it does not match, then the statement is incorrect.
Comment 71   by Moderator   @ 1970-01-01 00:00
The way to check which header file is required for a function is to use the alphabetical function reference link on the unit website. In this case, you are correct about the header file. It is good practice to include string.h for portability and performance reasons. It happens that GNU GCC is very "relaxed" about this requirement, so, many libraries are automatically included for convenience. However, when we compile for performance applications, there are compiler settings which are set to be much more strict.
Comment 70   by Moderator   @ 1970-01-01 00:00
The value does not affect the amount of memory allocated. The data type determines that amount of memory allocated to a variable.
Comment 69   by Moderator   @ 1970-01-01 00:00
There are errors in the program caused by the use of incorrect data types with the division operation. This is covered in the lecture notes. Is the float data type appropriate to represent the number of pennies? Separately, there are documentation links with worksheet 6 that explains how to specify decimal places in the output. There are also examples in the lecture notes.
Comment 68   by Moderator   @ 1970-01-01 00:00
Do not copy and paste the code from the worksheet. The problem is caused by the line numbers when you copy. Line numbers are for visual convenience, they are not source code.
Comment 67   by Moderator   @ 1970-01-01 00:00
The error is that you are mixing the concept of a coin with the number of coins. For example, the concept of a 5p coin is that each coin is worth 5 pence. That concept does not indicate how many 5p coins I might have in my wallet. Use that concept to create a variable. For example: int fivePenceCoins; declares a variable. Next, let's say I have 4 such coins in my wallet. The number 4 is what I would use to initialize the variable I created earlier. For example: int fivePenceCoins = 4; would declare and initialize the variable. To calculate the amount of money, the computer would not know that "fivePenceCoins" means 5 pence for each coin. We have to do that by using a multiplication operation. For example: printf( "%d pence", fivePenceCoins * 5 ); would display 20 pence because 4*5=20. See if you can apply this approach to the other coins.
Comment 66   by Moderator   @ 1970-01-01 00:00
The use of sizeof() was incorrect for worksheet 7, so, I'm glad to see you took that out of the program. The current version using floating point data type only looks good. To add the use of integer data types, look at the previous worksheets and the lecture notes where it discuss the use of division and automatic data type conversion in C programs.
Comment 65   by Moderator   @ 1970-01-01 00:00
Statement 15 is incorrect. Look at the lecture notes to see the example for using scanf().
Comment 64   by Moderator   @ 1970-01-01 00:00
When you made the changes to statements with the max limit values + 1, that would generate different output than the original program with just the max limit values. Then you should look at the 2 different output displays and consider why the output changed due to data type and binary encoding. The worksheets are activities aimed to give you practice. It is not intended to be the same as lectures.
Comment 63   by Moderator   @ 1970-01-01 00:00
Reply to comment 4: Your observation is correct. Data value does not affect the amount of memory. The data type determines the amount of memory allocated for each variable.
Comment 62   by Moderator   @ 1970-01-01 00:00
The reason 1/3 is different than 0.33 is the way the compiler handles floating point numbers. Look at the notes from lecture.
Comment 61   by Moderator   @ 1970-01-01 00:00
Look at the reference documentation provided on the unit website. Either look for the maths.h header file or look alphabetically for the function pow().
Comment 60   by Moderator   @ 1970-01-01 00:00
Changing the value of a variable does not affect the amount of memory it uses. The amount of memory is controlled by the data type. Each data type has limits on values that it can encode in the memory space that it has available. The worksheet is getting you familiar with those limits.
Comment 59   by Moderator   @ 1970-01-01 00:00
Did you mean lines 10 and 11?
Comment 58   by Moderator   @ 1970-01-01 00:00
That ok as long as you know how to use character variables.
Comment 57   by Moderator   @ 1970-01-01 00:00
Look at the lecture notes about data types and binary encoding.
Comment 56   by Moderator   @ 1970-01-01 00:00
When the output for lines 18 and 22 became negative, think about what maybe happening to the memory in order for that to happen. It has to do with the signed binary encoding for integers. The reason the output for line 14 did not become negative is that the compiler is giving you 4 bytes of memory, even though it is only required to give you 2 bytes for a short. The use of the %d format tells the compiler to interpret the variable as an integer as compared to the %c format which tells the compiler to interpret the variable as an ASCII code, which we call a character.
Comment 55   by Moderator   @ 1970-01-01 00:00
Re-read my comment 4. You are looking at the wrong revision numbers.
Comment 54   by Moderator   @ 1970-01-01 00:00
Choose the format that matches the data type of the variable you want to display. If you're trying to print int data type, then, you want to use %d format. Variable code7 is appropriate for number of pennies. But, should variable code8 be an integer to represent the number of pounds? Would another data type be more suitable?
Comment 53   by Moderator   @ 1970-01-01 00:00
The max value for a short is as displayed in the program. However, the compiler is giving you 4 bytes for a short, even though it is only required to give you 2 bytes. That is the reason you can exceed the max value for a short.
Comment 52   by Moderator   @ 1970-01-01 00:00
The behaviour of the short is not a mistake. The compiler is giving you 4 bytes for a short, even though it is only required to give you 2 bytes.
Comment 51   by Moderator   @ 1970-01-01 00:00
Check the size of double and long double and you will see that there is a difference. That is the reason for the different format code.
Comment 50   by Moderator   @ 1970-01-01 00:00
Wait until we cover arrays later to use strings. For now, either write one program for each shape, or, use a numeric input for shape, e.g. 1 is prism, 2 is pyramid.
Comment 49   by Moderator   @ 1970-01-01 00:00
The worksheet is trying to show you that the line number from the compiler is an approximation. You need to check above and below the line numer provided by the compiler error message.
Comment 48   by Moderator   @ 1970-01-01 00:00
Click on the link to the revision you want to re-edit. Then, look for a button after the code box, that says "Re-edit this old revision". Click that button to re-edit the old version.
Comment 47   by Moderator   @ 1970-01-01 00:00
Select a specific regular polygon to use in your program. It is not necessary to handle all types of prisms. The goal of the worksheet is to get you to think about the requirements of the problem and formulating steps to solve the problem.
Comment 46   by Moderator   @ 1970-01-01 00:00
In Revision 18, the program is exceeding the maximum limit permitted for each data type. This has an effect of "wrapping around" to the lowest available negative value because it is a signed data type. This is similar to moving from 'Z' to 'A' when you reach the end of the alphabet and "wrapping around" to the beginning of the alphabet.
Comment 45   by Moderator   @ 1970-01-01 00:00
There is information about a free textbook and a print textbook on the unit website.
Comment 44   by Moderator   @ 1970-01-01 00:00
Yes, the division needs to be done each time the program uses the sizeof() keyword. The number of decimal places can be controlled by using the %.2f format.
Comment 43   by Moderator   @ 1970-01-01 00:00
There is no problem with taking time to learn. It is more important that you are willing to put the time and effort into working on every worksheet and gradually work on the coursework assignment.
Comment 42   by Moderator   @ 1970-01-01 00:00
Once you have the division working, then you need to change the data type for bytes to a floating point type because of the division operator. After changing the data type, then each printf() function call has to use a different format placeholder to match the new floating point data type.
Comment 41   by Moderator   @ 1970-01-01 00:00
1 word = 2 bytes, which means that a division operation is required. For example, line 20, could be: bytes = sizeof( code1 ) / 2;
Comment 40   by Moderator   @ 1970-01-01 00:00
The format has to match the data type. For example, if you use %f to display output, then the variable should by type float. The default when displaying floating point values is 6 digits of precision. You can change that by using a period and a number after the % format. For example, %.2f will print a floating point number with 2 decimal places.
Comment 39   by Moderator   @ 1970-01-01 00:00
The unit does not require knowledge of programming before university. The purpose is to teach you programming. The way to learn is to consistently attend and ask questions at lecture, do your worksheets until you understand them completely and gradually work on your coursework. Effort is an important factor to success.
Comment 38   by Moderator   @ 1970-01-01 00:00
Reply to comment 7: The % format changes the output, either a number or a character. But, the variable is the same for both lines 11 and 12. That means that the variable name 'code' is stored as a number, but, can be displayed as a character if told to by using the %c format.
Comment 37   by Moderator   @ 1970-01-01 00:00
Reply to comment 6: Revisions of your coursework page refer to previously saved versions. Look at the links that are displayed amongst the comments. At the very bottom of the page, it shows links for Revision 1 and increases as you go up the page. The revision number increases as you save new versions.
Comment 36   by Moderator   @ 1970-01-01 00:00
That looks like a promising start to the coursework.
Comment 35   by Moderator   @ 1970-01-01 00:00
Worksheet 6 was about using decimal values with floating point data types. Did you understand everything in the worksheet? Did you read all the required links at the end of the worksheet?
Comment 34   by Moderator   @ 1970-01-01 00:00
The parentheses affect the order of arithmetic operations. But, you want to divide. If 1 word is equal to 2 bytes, then you want to divide the number of bytes by 2 in order to calculate the equivalent amount in words. For example, line 18 could be: words = sizeof( code1 ) / 2
Comment 33   by Moderator   @ 1970-01-01 00:00
Reply to comment 3: Look at lines 11 and 12. Each line produces a different output. But, they are nearly identical except for a very specific and important difference. Look closely.
Comment 32   by Moderator   @ 1970-01-01 00:00
Reply to comments 1 and 2: Check the output from Revision 14 and Revision 15. Look closely. The output is different.
Comment 31   by Moderator   @ 1970-01-01 00:00
You are finished with a worksheet when you understand the tasks and questions in the worksheets. That decision is made by each student.
Comment 30   by Moderator   @ 1970-01-01 00:00
We usually think of money as having 2 decimal places. Can you make it display just 2 decimal places in the output?
Comment 29   by Moderator   @ 1970-01-01 00:00
Comment 17 is correct. The value of the number does not affect the amount of memory. Only the data type determines the amount of memory.
Comment 28   by Moderator   @ 1970-01-01 00:00
The % output format affects how the compiler tries to interpret the data variable.
Comment 27   by Moderator   @ 1970-01-01 00:00
This comment is about Revision 14. Line 5 declares the length in furlongs. Line 6 declares the length in kilometres. Your goal is to find the correct factor to convert furlongs into kilometres. Line 8 displays the output message. The % symbol is a placeholder for the numbers. A scanf() is not needed because the program does not need input from the user.
Comment 26   by Moderator   @ 1970-01-01 00:00
Look at lines 18, 24, 27 and 30. The sizeof keyword calculates the amount of memory used in bytes. Think about which math operation you need to use at those lines. Think about how many bytes make 1 word.
Comment 25   by Moderator   @ 1970-01-01 00:00
That is the right idea for your next step.
Comment 24   by Moderator   @ 1970-01-01 00:00
Yes, you keep saving your changes. Look at the comments and previous versions, you see that all your previous versions are available.
Comment 23   by Moderator   @ 1970-01-01 00:00
Make one change at a time. Try to understand one line of code at a time. For example, try to explain to yourself what line 7 means to the compiler. Then, move on to line 8, etc.
Comment 22   by Moderator   @ 1970-01-01 00:00
Look at lines 11 and 12. The same variable, code, is being printed twice - but, each output is different. Think about how that can happen.
Comment 21   by Moderator   @ 1970-01-01 00:00
The stdout in Revision 9 shows the max values permitted for each data type.
Comment 20   by Moderator   @ 1970-01-01 00:00
The worksheets and coursework are accessible outside of the lab.
Comment 19   by Moderator   @ 1970-01-01 00:00
The \t control character does not display properly due to HTML restrictions.
Comment 18   by Moderator   @ 1970-01-01 00:00
It looks like you found the parentheses that was missing.
Comment 17   by Moderator   @ 1970-01-01 00:00
It compiles. But, you need to decide whether you understand the output and whether the output is correct.
Comment 16   by Moderator   @ 1970-01-01 00:00
Look at the error message. Is there such a function as print? Look at the worksheets. What is the correct name of the function? Be careful about the details when writing C programs.
Comment 15   by Moderator   @ 1970-01-01 00:00
The conversion formula is incorrect.
Comment 14   by Moderator   @ 1970-01-01 00:00
Please ask if you need help. You should be making some progress on the worksheets. But, it looks like you've done very little work so far.
Comment 13   by Moderator   @ 1970-01-01 00:00
Yes, that's it. The purpose was to show you that a simple mistake of putting the decimal point in the wrong place when typing may cause the program output to be incorrect - and the compiler can't help you to detect it. Logic errors require the programmer to examine their own work.
Comment 12   by Moderator   @ 1970-01-01 00:00
Very good progress on the coursework! While you are writing the comments, look for opportunities to make the source code more efficient.
Comment 11   by Moderator   @ 1970-01-01 00:00
Good work to learn about the 3-dimensional array! Thanks for letting me know about IE in the library. I will mention it at class to warn other students about the problem. Think about how you might add some of the optional features.
Comment 10   by Moderator   @ 1970-01-01 00:00
Yes, that would be fun feature to add to your program.
Comment 9   by Moderator   @ 1970-01-01 00:00
The output placeholder is incorrect because you used the digit '1' when it should be the character 'l' (lowercase L). It should be %.2lf
Comment 8   by Moderator   @ 1970-01-01 00:00
Which version shows that you finished worksheet 3? Did you have a specific question about the furlong conversion?
Comment 7   by Moderator   @ 1970-01-01 00:00
Each time you save, a copy is kept. So, to do new work, just edit the page again, write your new program, then, click save. Look at the comments and you will see links to view old versions of your work.
Comment 6   by Moderator   @ 1970-01-01 00:00
I tested the current version and I can see output. Please be more specific about what you see differently at the library computers.
Comment 5   by Moderator   @ 1970-01-01 00:00
Do not use Dev-C++. The coursework for ALL students must be assessed using the same compiler, which is why ALL students must learn to use the GCC compiler on Mosaic.
Comment 4   by Moderator   @ 1970-01-01 00:00
Comments can be put anywhere. Usually, we write comments close to the affected code.
Comment 3   by Moderator   @ 1970-01-01 00:00
The topics are covered gradually. The first 3 worksheets help students learn how to use Mosaic and development tools. For example, we will cover arrays several weeks later.
Comment 2   by Moderator   @ 1970-01-01 00:00
Please check the furlong article, the conversion formula is incorrect.
Comment 1   by Moderator   @ 1970-01-01 00:00
That is the right idea. We will cover the use of number formats in several weeks. Meanwhile, try this link http://cnfolio.com/public/libc/Output-Conversion-Syntax.html