473,396 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Errors in code for Miracle C Compiler

I'm trying to compile this code into miracle c compiler and I'm having problems, I appreciate if somebody help me with any mistakes in the code or write down the correct one. thanks..

Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2. void main (void)
  3. {
  4. int age = 0;
  5. printf("Please enter your age:");
  6. scanf("%d",&age);
  7. }
  8. int difference = age - 18;
  9. if(difference < 0)
  10. printf("\nI’m sorry, you are too young to vote.");
  11. else
  12. printf("\nYou can vote!");
  13. }
Dec 20 '09 #1
3 1696
Banfa
9,065 Expert Mod 8TB
Line 2
main returns int.

int main()

Line 7
Superflous } closes main before the functions code has actually finished

Line 8
Unless you compiler is C99 compliant you can't declare variables in the middle of a function.
Dec 20 '09 #2
Thank you very much for your great advise, I wanted to add a code saying that :

If they are not old enough, display the number of years they have to wait. For example, age 17 has to wait 1 year, age 19 has been eligible for 1 year

Where and how to write that? appreciate your help.

Thanks in advance
Dec 21 '09 #3
Banfa
9,065 Expert Mod 8TB
Basically you just need to modify the printf statements on lines 10 and 12 to print the value of difference as well as the additional text.
Dec 21 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: jon morgan | last post by:
OK, I'm going to be brave. There is a bug in VS.Net 1.1 that causes random compiler errors. I have raised this issue in posts at least three time in the past couple of months without attracting...
1
by: Hafeez | last post by:
I am having real trouble compiling this code http://www.cs.wisc.edu/~vganti/birchcode/codeHier/AttrProj.tgz The attachment shows errors when compiled using the current version of g++ in a...
18
by: tomakated | last post by:
Hi, i'm new here and I can't get my get_item_price() function to work I need it to take in 4 items int main() { double item1, item2, item3, item4, lowest=0, total; char response;
6
by: PCHOME | last post by:
Hi! I am looking for a good free IDE C Compiler. Dose any have experience on using them? Which is better? Bloodshed C or Miracle C? Or anyother free IDE C Compiler you like to recomend? ...
24
by: Massimo Soricetti | last post by:
Hello, I'm not a C newbie, but I'm teaching C programming (well... FIRST programming and then C) to other guys these days and it's driving me to some reflexions on the language. It's not...
6
by: Russ | last post by:
This really is the worst Microsoft product I have ever had the misfortune to work with. After the excellent feattures and stability of VS.NET 2002 and 2003, I was confident enough to start a...
24
by: pat | last post by:
Hi everyone, I've got an exam in c++ in two days and one of the past questions is as follows. Identify 6 syntax and 2 possible runtime errors in this code: class demo {
3
by: Stephon Woodland | last post by:
Hello everyone/anyone, I am a stutdent with UoP online. I just learning the IT world and the class I am taking right now is "Programming Concepts" using the C programming language. I have just...
1
by: dave0875 | last post by:
I am a student at University of Phoenix and required to use the Miracle C compiler. I recently completed an assignment by using seperate functions to populate arrays of character strings, which...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.