473,396 Members | 1,892 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.

Declaration Syntax Error

Expand|Select|Wrap|Line Numbers
  1. #include<iostream.h>
  2.     #include<conio.h>
  3.     #include<stdio.h>
  4.     #include<stdlib.h>
  5.     struct st_base
  6.      {
  7.      char name[20];
  8.      int roll_no;
  9.      int s1,s2,s3,s4,mks;
  10.      float percentage;
  11.      char grade;
  12.      }
  13.       r1[10];
  14.        static int m;
  15.        void accept (struct st_base r1[10],int *);
  16.        void display (struct st_base r1[10],int *);
  17.        void calc (struct st_base r1[10],int);
  18.        void search (struct st_base r1[10],int *);
  19.        void insert (struct st_base r1[10],int *);
  20.        void removel (struct st_base r1[10],int *);
  21.    void main()
  22.     {
  23.      int s,i,j,ch,value;
  24.      clrscr();
  25.      cout<<"\\n \\n \\t \\t \\t DR.D.Y.PATIL POLYTECHNIC COLLEGE \\n";
  26.      cout<<"\\n \\t $$$$$$ PROJECT IS CREATED BY PRIYANKA,SAVITA,RAMYA,POOJA $$$$$$ \\n";
  27.      cout<<"\\n \\t \\t \\t SECOND YEAR COMPUTER ENGINEERING .. \\n";
  28.      cout<<"\\n \\n \\n \\n \\n PLEASE ENTER NUMBER OF RECORD TO BE STORED";
  29.      cin>>s;
  30.      accept(r1, &s);
  31.      cout<<"\\n \\n \\t \\t $$$$ STUDENT DATABASE OF S.Y.C.E.$$$$";
  32.      cout<<"\\n \\n 1:- Display record";
  33.      cout<<"\\n \\n 2:- Insert record";
  34.      cout<<"\\n \\n 3:- Search record";
  35.      cout<<"\\n \\n 4:- Delete record";
  36.      cout<<"\\n \\n 5:- Exit record";
  37.       do
  38.        {
  39.     cout<<"\\n \\n Please enter your choice:-";
  40.     cin>>ch;
  41.     switch(ch)
  42.      {
  43.       case 1:
  44.       clrscr();
  45.       display(r1, &s);
  46.       break;
  47.       case 2:
  48.       clrscr();
  49.       display(r1, &s);
  50.       cout<<"\\n \\n \\n Insert any record:-";
  51.       insert (r1, &s);
  52.       break;
  53.       case 3:
  54.       clrscr();
  55.       display(r1, &s);
  56.       search(r1, &s);
  57.       break;
  58.       case 4:
  59.       clrscr();
  60.       display(r1, &s);
  61.       cout<<"\\n \\n 1:Display record";
  62.       cout<<"\\n \\n 2:Insert record";
  63.       cout<<"\\n \\n 3:Search record";
  64.       cout<<"\\n \\n 4:Delete record";
  65.       cout<<"\\n \\n 5:Exit record";
  66.       cout<<"\\n roll_no \\t Name \\t MATHS \\t DT \\t PIC \\t DBMS \\t Percentage \\t Grade \\n";
  67.       int j;
  68.       int *p;
  69.       for(j=0 ;j<*p ;j++)
  70.        {
  71.         if(r1[j].roll_no!=0)
  72.          {
  73.           cout<<" "<<r1[j].roll_no<<"\\t"<<r1[j].name<<"\\t"<<r1[j].s1<<"\\t"<<r1[j].s2<<"\\t"<<r1[j].s3<<"\\t"<<r1[j].s4<<"\\t"<<r1[j].mks<<"\\t \\t "<<r1[j].grade<<"\\t \\t";
  74.          }
  75.        }
  76.      };
  77.      //Search Functoin Defination//
  78.     void search (struct st_base r1[10],int *p)
  79.      { // I am Getting 'Declaration Syntax Error' here 
  80.       int j,k;
  81.       cout<<"\\n Enter the rollno you want to search";
  82.       cin>>j;
  83.       for(k=0;k<(*p);k++)
  84.        {
  85.         if(r1[k].roll_no==j)
  86.          {
  87.           cout<<"\\n Roll_no \\t Name \\t MATHS \\t DT \\t PIC \\t DBMS \\t percantage\\t Grade";
  88.           printf("\\n %d \\t \\t %s \\t \\t %d \\t %d \\t %d \\t %d \\t %c",r1[k].roll_no,r1[k].name,r1[k].s1,r1[k].s2,r1[k].s3,r1[k].s4,r1[k].mks,r1[k].grade);
  89.           break;
  90.          }
  91.        }
  92.         if(k>=(*p))
  93.          printf("THE INPUT IS INVALID");
  94.      }
  95.      //INSERT Function Defination//
  96.     void insert(struct st_base r1[10],int *p)
  97.      {
  98.       int j;
  99.       //printf("%d",*p);
  100.       j=*p;
  101.       j++;
  102.       (*p)++;
  103.       //printf("%d,%d,%d",*p,j,m);
  104.       accept(r1, &j);
  105.       printf("\\n");
  106.       calc(r1,j);
  107.       display(r1, &j);
  108.      }
  109.      //REMOVAL Function Defination//
  110.     void removel(struct st_base r1[10],int *p)
  111.      {
  112.       int h,i,l,k;
  113.       l=*p;
  114.       printf("\\n The value of pointer %d",l);
  115.       printf("\\n Please enter the roll number you want to delete");
  116.       scanf("%d", &h);
  117.       for(i=0;i<*p;i++)
  118.        {
  119.         removal (r1,&s);
  120.         break;
  121.         case 5;
  122.         exit (0);
  123.         break;
  124.        }
  125.       cout<<"\\n \\n \\n \\n \\n Do you want to continue ? (Yes=1 || No=0 :)";
  126.       cin>>value;
  127.      };
  128.        }
  129.     while (value==1);
  130.     exit (0);
  131.  
  132.        //ACCEPT Function Defination//
  133.     void accept (struct st_base r1[10],int *p)
  134.      { //Here also I m getting the same error// 
  135.       int i;
  136.       for(i=m;i<(*p);i++)
  137.        {
  138.         m++;
  139.         cout<<endl;
  140.         cout<<"\\n ENTER YOUR NAME :-";
  141.         cin>>r1[i].name;
  142.         cout<<"\\n ENTER YOUR ROLL NUMBER :-";
  143.         r1[i].roll_no=m;
  144.         cout<<r1[i].roll_no;
  145.         cout<<"\\n ENTER MARKS OF MATHS :-";
  146.         cin>>r1[i].s1;
  147.         cout<<"\\n ENTER MARKS OF DT :-";
  148.         cin>>r1[i].s2;
  149.         cout<<"\\n ENTER MARKS OF PIC :-";
  150.         cin>>r1[i].s3;
  151.         cout<<"\\n ENTER MARKS OF DBMS :-";
  152.         cin>>r1[i].s4;
  153.         calc(r1,i);
  154.        }
  155.      }
  156.       //CALC Function Defination//
  157.     void calc(struct st_base r1[10],int i)
  158.      {
  159.       int *p;
  160.       for(i=0;i<10;i++)
  161.        {
  162.         r1[i].mks=(r1[i].s1+r1[i].s2+r1[i].s3+r1[i].s4)/4;
  163.         if(r1[i].mks >=0 && r1[i].mks < 35)
  164.          r1[i].grade ='F';
  165.         else
  166.          if (r1[i].mks >=35 && r1[i].mks <50)
  167.           r1[i].grade ='D';
  168.          else
  169.           if (r1[i].mks >=50 && r1[i].mks <60)
  170.            r1[i].grade ='C';
  171.           else
  172.            if (r1[i].mks >=60 && r1[i].mks <75)
  173.         r1[i].grade ='B';
  174.            else
  175.         r1[i].grade ='A';
  176.        }
  177.      }
  178.  
  179.      //Display Function Defination//
  180.     void display(struct st_base r1[10],int *p)
  181.      {
  182.       int j,n;
  183.       cout<<"\\n \\n \\t \\t \\t DR.D.Y.PATIL.POLYTECHNIC COLLEGE \\n"
  184.       cout<<"\\n \\t $$$$$$ PROJECT IS CREATED BY PRIYANKA,SAVITA,RAMYA,POOJA $$$$$$$ \\n";
  185.       cout<<"\\n \\t \\t \\t SECOND YEAR COMPUTER ENGINEERING ..\\n";
  186.       cout<<"\\n \\n \\t $$ STUDENT DATABASE OF S.Y.C.O. $$";
  187.       if(r1[i].roll_no==h)
  188.        {
  189.         for(k=h;k<=1;k++)
  190.          r1[k-1]=r1[k];
  191.        }
  192.       //}
  193.         for(i=0; i<*p; i++)
  194.          printf("\\n \\n %d",r1[i].roll_no);
  195.  
  196.        display(r1,&l);
  197.      };
  198.     };
  199.  
Oct 16 '08 #1
2 1280
r035198x
13,262 8TB
1.) What was the error then?
2.) Decide whether you want to write this in C or in C++.
Oct 16 '08 #2
newb16
687 512MB
Because you are declaring search() function within 'do' loop of previous function.
Oct 16 '08 #3

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

Similar topics

83
by: Alexander Zatvornitskiy | last post by:
Hello All! I'am novice in python, and I find one very bad thing (from my point of view) in language. There is no keyword or syntax to declare variable, like 'var' in Pascal, or special syntax in...
16
by: Bhushit Joshipura | last post by:
This post contains one question and one proposal. A. May I know why order of evaluation of arguments is not specified in C/C++? I asked a question in comp.lang.c++ for the following...
3
by: Michael Sgier | last post by:
Hello with the original code below I get the error: "forward declaration of `struct CPlayer'" class CPlayer; // what does this do? Instantiate the class CPlayer? // what's a forward...
7
by: Jacob Schmidt | last post by:
Could anyone correct the error in my logic here?: #include <stdio.h> #include <stdlib.h> main () { const char message1 = {"\nCurved portion of graph -- D.G.A.C.\ \n A B C"}; const char...
2
by: Nils Emil P. Larsen | last post by:
Hello I have read about a C shared library which I want to use in my C program. (It's a library to encode/decode packets from/to a serial bus running with the SNAP-protocol). Unfortunatly...
3
by: Wild Wind | last post by:
Hello, I made a post relating to this issue a while back, but I haven't received any answer, so here I am again. I am writing a mixed C++ dll which uses the following declaration: typedef...
4
by: Alan Foxmore | last post by:
Hi everyone, I'm new to C# and I was hoping I could get some clarification on the syntax for jagged and multidimensional arrays. Here is my question: The following syntax is correct for...
2
by: srikar | last post by:
Hi I am having a problem using typedef what does these declaration mean? typedef gtb(string_t, tt_type_enum) tt_type_table( &stringless, &stringequals ); typedef gtb(string_t,tt_qual_enum)...
10
by: fred.zakity | last post by:
Can someone please explain this function pointer declaration: float (* getptr (char opcode) ) (int, int); I'm confused by the syntax - I have not seen a function pointer with the extra...
11
by: mdh | last post by:
I decided to make a single file containing all the repetitive functions in K&R so that I could concentrate on the new discussions. This went along just fine, and with each new function, added the...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.