473,387 Members | 1,435 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,387 software developers and data experts.

Parse Error

I'm trying to compile my program using "gcc" and keep getting a parse error at end of input. Can anyone help me?
Attached Files
File Type: txt rose_curve2.txt (918 Bytes, 313 views)
Nov 28 '08 #1
2 1064
gpraghuram
1,275 Expert 1GB
You were missing a couple of braces.
Check the following code
Expand|Select|Wrap|Line Numbers
  1. /* Program #25 -- file prgm25.c rev. 11/26/08
  2. This program will give you points on a graph
  3. in a file called "rosecurve.txt". These points
  4. will create a rose curve. */
  5.  
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <math.h>
  9.  
  10. float polar_to_x(float, float);
  11. float polar_to_y(float, float);
  12.  
  13. int main()
  14. {
  15.     float thata,temp,n,x,y,p,j,r=5,s=3;
  16.     int a,b;
  17.     FILE *output;
  18.  
  19.     output=fopen("rosecurve2.txt","wt");
  20.  
  21.     for(j=0;j<6.28;j+=0.01)
  22.     {
  23.         n=r/s;
  24.         temp=r*s;
  25.         for(a=1;a<31;a+=2)
  26.         if(temp==a)
  27.         {
  28.             thata=3.14159*s*1;
  29.             break;
  30.         }
  31.         for(b=0;b<32;b+=2)
  32.         if(temp==b)
  33.         {
  34.             thata=3.14159*s*2;
  35.             break;
  36.             {
  37.             x=polar_to_x(n,thata);
  38.             y=polar_to_y(n,thata);
  39.             fprintf(output,"%f %f\n",x,y);
  40.             }
  41.         }
  42.     }
  43.     fclose(output);
  44. }
  45.  
  46.  
  47. float polar_to_x(float n,float thata)
  48. {
  49.     float x;
  50.  
  51.     x=n*cos(thata);
  52.     return x;
  53. }
  54.  
  55. float polar_to_y(float n,float thata)
  56. {
  57. float y;
  58.  
  59. y=n*sin(thata);
  60. return y;
  61. }
  62.  
  63.  
Raghu
Nov 28 '08 #2
Banfa
9,065 Expert Mod 8TB
You have a brace on your second if statement the wrong way round
Nov 28 '08 #3

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

Similar topics

2
by: Steven | last post by:
I got a "Parse error: parse error in ..." in this line: if(empty($_POST){ ..... But if I fist assign $ssn=$_POST; and then if(empty($ssn){ ... it is working. Any advice? Thanks in advance.
1
by: H.L Bai | last post by:
hi, everybody i meet a parse error when i used the xml4c. any proposal is helpful. The error is following .../XMLRegionHandler.h:59 parse error before '*' .../XMLRegionHandler.h:60 parse...
2
by: Vittal | last post by:
Hello All, I am trying to compile my application on Red Hat Linux 8 against gcc 3.2.2. Very first file in application is failing to compile. I tried compiling my application on Linux 7.2...
21
by: BWIGLEY | last post by:
Basically I've just started making a game. So far it makes an array 25 by 20 and tries to make five rooms within it. In scr_make_room() there's parse errors: 20 C:\c\Rooms\Untitled1.c parse error...
6
by: trevor | last post by:
Incorrect values when using float.Parse(string) I have discovered a problem with float.Parse(string) not getting values exactly correct in some circumstances(CSV file source) but in very similar...
5
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C++ programming. FYI Although I have called...
1
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming. FYI Although I have called this...
1
by: Phaelle | last post by:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' What does that error mean? I canīt find the mistake!! In another script, I have got another kind of mistake : parse...
2
by: Lawrence Krubner | last post by:
Imagine a template system that works by getting a file, as a string, and then putting it through eval(), something like this: $formAsString = $controller->command("readFileAndReturnString",...
5
by: goldtech | last post by:
SAX XML Parse Python error message Hi, My first attempt at SAX, but have an error message I need help with. I cite the error message, code, and xml below. Be grateful if anyone can tell me...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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
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...

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.