472,804 Members | 945 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Declaration Syntax error

Hello peoples
i am having trouble compiling this program getting a the error is "Declaration Syntax error" using borland c++ bulider v.6 if any one can help thanks

Expand|Select|Wrap|Line Numbers
  1. void __fastcall TFrame2::FrameClick(TObject *Sender)
  2. {
  3.  int main()
  4. {                                    //it is showing the error right here
  5.  
  6.         ifstream myfile("c:\fileopen.txt");
  7.         if(myfile.is_open())
  8.         {
  9.                 while(!myfile.eof())
  10.                 {
  11.                         getline(myfile, line);
  12.                         cout<<line<<endl;
  13.                 }
  14.                 myfile.close();
  15.         }
  16.         else cout<<"Unable to open file"<<endl;
  17.  
  18. }
  19.          return 0;
  20. }
  21.  
Sep 21 '06 #1
3 17339
Banfa
9,065 Expert Mod 8TB
You appear to be trying to declare main inside

void __fastcall TFrame2::FrameClick(TObject *Sender)

this is wrong your structure should be

Expand|Select|Wrap|Line Numbers
  1. void __fastcall TFrame2::FrameClick(TObject *Sender)
  2. {
  3. // Function code
  4. }
  5.  
  6. int main(int argc, char **argp)
  7. {
  8. // Function code
  9. }
  10.  
Sep 22 '06 #2
moh3n
1
Hey Mandogon did you get it? I mean did you solve your problem?
I have also the same problem with a little difference.
I have set all of my functioons right but I have still the same error.
this is the programm.

#include<stdio.h>
#include<conio.h>
#include<iostream.h>
int iszoj(long int a)
{
if (a%2!=0)
return (0);
return (1);
}
int isaval(long int b)
{

for(int i=2;i<b/2+1;i++){
for(int j=2;j<i;j++)
if(b%j==0)
return (0);
return (1);
}
void main()
{ //I have the error here.
int a,b,second;
clrscr();
cin>>a>>b;
for(int i=a;i<=b;i++)
if (iszoj(i))
for(int j=1;j<I/2+1;j++)
if(isaval(j))
{
second =i-j;
if(isaval(second))
cout<<j<<"+"<<second<<"="<<i;
}
getch();
}
Dec 17 '07 #3
manjuks
72
closing brace of for loop in isaval(long int b) is missing. check it carefully.
Dec 18 '07 #4

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

Similar topics

2
by: kellymart87 | last post by:
//remain.cpp #include <iostream.h> #include <conio.h> int main() getline ()
5
DanielTNBaker
by: DanielTNBaker | last post by:
Basically gettting a "Declaration Syntax Error" do not understand what i have done wrong would appreciate it if someone could help. void Search_Client(void); void PriceList(void); void...
2
by: Lothsfeld | last post by:
Can someone help me w/ this I can't run it and I keep getting errors unable to open include file 'stdio.h' and declaration syntax error #include<stdio.h> main(); { int a,b,c; ...
7
by: Bowzer1999 | last post by:
I am a beginner at C++ and would be very grateful if someone could simply tell me why my program will not compile. My program is as follows, #include <stdio.h> #define int 1ST VALUE = 23.0 ...
4
by: networkmancer | last post by:
Written in Turbo C++ so dont tell me its very messy because I know it is and this is an assignment that we must stick in to. The source of the problem is in Case 5 int main { . I just dont know how...
11
by: Blondie1966 | last post by:
Im trying to write a program about a truck inventory with trucks coming and going and the amount in each one, but keep coming up with declaration syntax error.. Any help would be greatly appreciated....
3
by: dianaroslan | last post by:
There are three errors in coding during compile. one of them is the declaration syntax error. can help me to finish coding this? really need help from anyone who knows. i have some problem with my...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.