473,831 Members | 2,224 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Declaration Syntax error

31 New Member
Hello peoples
i am having trouble compiling this program getting a the error is "Declaratio n 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 17429
Banfa
9,065 Recognized Expert Moderator Expert
You appear to be trying to declare main inside

void __fastcall TFrame2::FrameC lick(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 New Member
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<iostre am.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(secon d))
cout<<j<<"+"<<s econd<<"="<<i;
}
getch();
}
Dec 17 '07 #3
manjuks
72 New Member
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
3998
by: kellymart87 | last post by:
//remain.cpp #include <iostream.h> #include <conio.h> int main() getline ()
5
1865
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 Exit(void); client_struct fetchrec(); <-- getting error here void writerec (FILE * client_file, struct client_struct client); thanks for help =]
2
4730
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; clrscr();
7
4636
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 void main() {
4
4204
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 to fix it. #include <stdio.h> #include <conio.h> #include<process.h> #include<dos.h> void graph(); void foo(){
11
3338
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. Im using Borland C++. Thanks #include <iostream.h> #include <iomanip.h> #include <stdlib.h> #include <conio.h> #include <string.h> #include <ctype.h>
3
1802
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 total function and declaration. #include <iostream> #include <conio> const int listSize=1; struct employeeInfo { char name, address,noPhone;
0
9794
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
10778
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10496
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...
0
10210
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9319
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...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5622
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4419
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
3967
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.