473,791 Members | 2,901 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Debug errors in Turbo C program

2 New Member
Hi there! I'm new in Turbo C... uhmm our teacher gave us a project to make a program in Turbo C. Im from the Philippines, and our project is due on tuesday, februrary 13, 2007... can anyone check my program? I used Turbo C ver. 2.01
And the following errors occured:
1) 51: Declaration Syntax Error
2) 149: Return statement missing ; in function Z
3) 150: Declaration Syntax Error

Here's my program below:
Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. #include<conio.h>
  3. #include<dos.h>
  4. main()
  5. {
  6.  int C, I, G, X, M, SD, GDP, YEAR;
  7.  clrscr();
  8.  printf("#######################################################\n");
  9.  printf("|                                                                                                           |\n");
  10.  printf("|You are now running the program GNP Calculator-Indicator or the|\n");
  11.  printf("|GNPCI. This program is created to calculate the GNP of our           |\n");
  12.  printf("|country through the use of its given data. Afterwards, the                 |\n");
  13.  printf("|GNP can then be interpreted. Moreover, the GNP acquired can be  |\n");
  14.  printf("|converted to other currency values. Lastly, this program also             |\n");
  15.  printf("|compares previous GNP accumulation from the previous year(s).     |\n");
  16.  printf("|                     Enjoy Using This Program!                                           |\n");
  17.  printf("|                                                                                                           |\n");
  18.  printf("|                          ^_^                                                                           |\n");
  19.  printf("#######################################################\n");
  20.  printf("=                                                                 =\n");
  21.  printf("Enter Personal Consumption data:\n");
  22.  scanf("%d", &C);
  23.  printf("Enter Capital Formation/Investment data:\n");
  24.  scanf("%d", &I);
  25.  printf("Enter Government Expenditure data:\n");
  26.  scanf("%d", &G);
  27.  printf("Enter Exports data:\n");
  28.  scanf("%d", &X);
  29.  printf("Enter Imports data:\n");
  30.  scanf("%d", &M);
  31.  printf("Enter the Statistical Discrepancy data:\n");
  32.  scanf("%d", &SD);
  33.  printf("Kindly enter the year of the data above entered:\n");
  34.  scanf("%d", &YEAR);
  35.  GDP=C+I+G+(X-M)+SD;
  36.  printf("The GDP of the year %d is %d", YEAR, GDP);
  37.  }
  38.  void A()
  39.  {
  40.   int GNP, GDP, NFIA, YEAR;
  41.   printf("You selected to continue the process.\n");
  42.   printf("Enter the Gross Domestic Product data:\n");
  43.   scanf("%d", &GDP);
  44.   printf("Enter the Net Factor Income from Abroad data:\n");
  45.   scanf("%d", &NFIA);
  46.   printf("Enter Year:\n");
  47.   scanf("%d", &YEAR);
  48.   GNP=GDP+NFIA;
  49.   printf("The GNP of our country for %d is %d", YEAR, GNP);
  50.   }
  51.   {
  52.   int ANSWER;
  53.   do{
  54.      printf("Do you still want to continue?\n");
  55.      printf("Press 1-Yes..2-No\n");
  56.      printf("Your answer:\n");
  57.      scanf("%d", &ANSWER);
  58.      }while(ANSWER!=2);
  59.      if(ANSWER==1)
  60.      A();
  61.      else
  62.      printf("Thanks for using this program! ^_^\n");
  63.      }
  64.      void INTERPRET()
  65.      {
  66.       int GNP;
  67.       printf("You decided to interpret the GNP.\n");
  68.       printf("Kindly enter the GNP:\n");
  69.       scanf("%d", GNP);
  70.       if(GNP<=100 000 000 000)
  71.       printf("Low GNP rating.");
  72.       else if((GNP>100 000 000 000>&&(GNP==950 000 000>>
  73.       printf("Average GNP rating.");
  74.       else
  75.       printf("Superior GNP rating.");
  76.       }
  77.       void PD()
  78.       {
  79.        int GNP, RATE, DOLLAR;
  80.        printf("You chose to convert the GNP to dollars\n");
  81.        printf("Enter GNP:\n");
  82.        scanf("%d", &GNP);
  83.        printf("Enter Exchange Rate:\n");
  84.        scanf("%d", &RATE);
  85.        DOLLAR= GNP*RATE;
  86.        printf("In dollar value, the GNP is $ %d.\n", DOLLAR);
  87.        }
  88.        void PY()
  89.        {
  90.     int GNP, RATE, YEN;
  91.     printf("You chose to convert the GNP to yen.\n");
  92.     printf("Enter GNP:\n");
  93.     scanf("%d", &GNP);
  94.     printf("Enter Exchange Rate:\n");
  95.     scanf("%d", &RATE);
  96.     YEN= GNP*RATE;
  97.     printf("In yen value, the GNP is Y %d.\n", YEN);
  98.     }
  99.     void PE()
  100.     {
  101.      int GNP, RATE, EURO;
  102.      printf("You chose to convert the GNP to euro.\n");
  103.      printf("Enter GNP:\n");
  104.      scanf("%d", &GNP);
  105.      printf("Enter Exchange Rate:\n");
  106.      scanf("%d", &RATE);
  107.      EURO= GNP*RATE;
  108.      printf("In euro value, the GNP is E %d.\n");
  109.      }
  110.      void PL()
  111.      {
  112.      int GNP, RATE, LIRA;
  113.      printf("You chose to convert the GNP to lira.\n");
  114.      printf("Enter GNP:\n");
  115.      scanf("%d", &GNP);
  116.      printf("Enter Exchange Rate:\n");
  117.      scanf("%d", &RATE);
  118.      LIRA= GNP*RATE;
  119.      printf("In lira value, the GNP is L %d.\n");
  120.      }
  121.      {
  122.       int CHOICE;
  123.       do {
  124.           printf("*******MENU..Again*******\n");
  125.           printf("1. GNP Interpretation\n");
  126.           printf("2. GNP Peso to Dollar Conversion\n");
  127.           printf("3. GNP Peso to Yen Conversion\n");
  128.           printf("4. GNP Peso to Euro Conversion\n");
  129.           printf("5. GNP Peso to Lira Conversion\n");
  130.           printf("6. I am tired. I want to exit.\n");
  131.           } while(CHOICE!=6)
  132.           if (CHOICE==1)
  133.           INTERPRET();
  134.           else if (CHOICE==2)
  135.           PD();
  136.           else if (CHOICE==3)
  137.           PY();
  138.           else if (CHOICE==4)
  139.           PE();
  140.           else if (CHOICE==5)
  141.           PL();
  142.           else
  143.           printf("R.I.P., Rest In Prosperity!\n");
  144.           }
  145.           printf("Can you rate my program? Just enter a number from 1-10.\n");
  146.           int Z(int Y)
  147.           {
  148.            return Y*10
  149.            }
  150.            {
  151.         int W, Y, Z;
  152.         printf("Your rating: (1 being the highest while 10 being the lowest)\n");
  153.         scanf("%d", Y);
  154.         W= Z(Y)
  155.         printf("Your rating for this program is %d.\n", W);
  156.         }
  157.         {
  158.          int COMMENT;
  159.          printf("Any comment?\n");
  160.          printf("Comments:\n");
  161.          printf("1-nice job!..2-good..3-needs improvement\n");
  162.          switch(COMMENT)
  163.          {
  164.           case 1: printf("Nice job! Keep it up!\n"); break;
  165.           case 2: printf("Good! You passed!\n"); break;
  166.           case 3: printf("Needs Improvement. Need more innovations.\n"); break;
  167.           default: printf("No comment.\n"); break;
  168.           } getch(); while(COMMENT!=3);
  169.             getch();
  170.             return 0;
  171.  } 
  172.  
Thank you in advance! i hope you could help me...
Feb 11 '07 #1
2 11239
jocobunshin
2 New Member
please help....

i don't really know what the errors on my program means
Feb 11 '07 #2
Ganon11
3,652 Recognized Expert Specialist
The following errors occurred:
1) 51: Declaration Syntax Error
2) 149: Return statement missing ; in function Z
3) 150: Declaration Syntax Error

Expand|Select|Wrap|Line Numbers
  1. void A()
  2.  {
  3.   int GNP, GDP, NFIA, YEAR;
  4.   printf("You selected to continue the process.\n");
  5.   printf("Enter the Gross Domestic Product data:\n");
  6.   scanf("%d", &GDP);
  7.   printf("Enter the Net Factor Income from Abroad data:\n");
  8.   scanf("%d", &NFIA);
  9.   printf("Enter Year:\n");
  10.   scanf("%d", &YEAR);
  11.   GNP=GDP+NFIA;
  12.   printf("The GNP of our country for %d is %d", YEAR, GNP);
  13.   }
  14.   {
  15.   int ANSWER;
  16.   // ...................................................
  17.  
  18.           int Z(int Y)
  19.           {
  20.            return Y*10; // Missing semicolon here
  21.            }
  22.                //.............................................
  23.            {
  24.         int W, Y, Z;
  25.         printf("Your rating: (1 being the highest while 10 being the lowest)\n");
  26.                 // ...
In the first section, you simply start a set of brackets {} without a function header or inside main - they simply are there. I don't think this is allowed - consider including this section (and the last section) in int main() instead of in their own little sections.

In the middle section, you had forgotten a semicolon after return Y * 10 - thus, the compiler never recognized the return statement.
Feb 11 '07 #3

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

Similar topics

2
286
by: Eitan | last post by:
Hello, Can I debug an asp file with Microsoft Dotnet Development environment (dotnet architecture) (or check whether the syntax is correct) ? If so, than how can I do that - need sample, please. Thanks :)
2
2227
by: Gustaf Liljegren | last post by:
I have a console program that takes one file and outputs another. The file name is submitted as an argument as usual. I can't figure out how to have the nice step-by-step debugging while also submitting arguments on the command-line. That is, first run the program as the end user, submit the argument, then get to the step-by-step debugging mode. Is there a way to do this? Gustaf
1
1231
by: fiona | last post by:
Hi all, I have set the break point on a statement in Page_Load event but it is not being hit. I have set the configuration of project to Debug mode and enable ASP.Net debugging, ASP debugging and SQL Server debugging. Could anyone help? Thanks alot!
3
1285
by: Meatball.Li | last post by:
A program can be debug by administrator, but when I run the program as a user, the vs.net 2003 tell me that I don't have the privilege to debug this web server process. I have modified machine.config and Temporary ASP.net Files directory as msdn said. Is there anything else I have to do to debug my program under user privilege?
1
969
by: Eitan | last post by:
Hello, Can I debug an asp file with Microsoft Dotnet Development environment (dotnet architecture) (or check whether the syntax is correct) ? If so, than how can I do that - need sample, please. Thanks :)
2
6278
by: Daz01 | last post by:
Hi all. Ive written a program and there are 2 errors that appear when I try to compile the program. I dont know how to correct them. Any help appreciated. Below are the errors ERROR 1: `cout' undeclared (first use this function) void marina::OutputList (void) { // lists the entire list in the marina on the screen boat * temp; if (BoatName) {
1
3394
by: kkk1979 | last post by:
Hi I have been working on an existing access 2000 project which is using the .ade. I got a problem in results. So I tried to debug .ade, but I am not able to do that. So every time I am making an ade from adp and then testing for results. Is there any way to make the project use .adp instead of .ade, so that I can debug ? Can anyone help please .....
0
1599
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
I have a testing client program, the purpose is send a xml file to a server program, and the server return another xml message. So I wrote a testing server program the simple one and make sure the communication is fine. After that I started to program more complicated server program, since there are many compliation error. The client program keep displaying: The remote server returned an invalid statuscode: #8221;500 Internal Server Error...
2
1337
by: RB | last post by:
I'm using MSIexplorer v6.x browser and I keep getting script debugging errors on line ...... at certain websites. I have set my security to Default, and disabled Script debugging, but I still keep getting them. Any ideas on how to fix this?
0
9669
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9515
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10207
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10154
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7537
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5558
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4109
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3713
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.