illegal structure operation is my error please help guys thankyouu
#include <iostream.h>
#include<conio.h>
#include<dos.h>
#include<ctype.h>
#include<process.h>
#include<iomanip.h>
#include <fstream.h> // file stream
// output file stream
int main()
{
clrscr();
int a;
char ch;
cout<<"Hello and thank you for visiting Payment Method";
cout<<"\n\n\nTo make a file, pick [1]";
cout<<"\n\nThe Payment Method should be displayed and computed, pick [2]";
cout<<"\n\nTo exit, pick [3]";
cout<<"\n\n\nEnter your pick here: ";
cin>>a;
switch(a){
case 1:{
// ofstream constructor opens file
ofstream outClientFile( "clients.dat", ios::out );
// exit program if unable to create file
if ( !outClientFile ) // overloaded ! operator
{
cerr << "File could not be opened" << endl;
} // end if
cout << "Enter the account, name, payment." << endl
<< "Enter end-of-file to end input.\n? ";
int account;
int name [30];
int payment=0;
int amount=0;
int rate=0;
int result=0;
// read account, name and result from cin, then place in file
while ( cin >> account >> name >> payment )
{
outClientFile << account << ' ' << name << ' ' << payment << ' ' << amount << ' ' << rate << ' ' << result << endl;
cout << "= ";
} // end while
//Note: ^q terminates the entire program, main() function cannot be used to return from the start
// return 0; // ofstream destructor closes file
}//end of case 1
// break; //it is removed to show the output automatically
case 2:{
clrscr();
ifstream inpfle;
ofstream outfle;
inpfle.open("clients.dat");
if(inpfle.fail())
{
cout<<"Error in Opening File. File does not exist";
exit(1);
}
else
{
cout<<"File found---Press any key to continue.";
}
getch();
int account;
int name [30];
int payment;
int amount;
int rate;
int result;
inpfle>>account>>name>>payment>>amount>>rate>>resu lt;
cout.setf(ios::left);
cout<<endl<<endl;
cout<<"\n\nAccount Name Payment Amount Rate Result"<<endl;
cout<<endl<<endl;
while(!(inpfle.eof()))
{
amount=payment*10;
rate=payment*0.10;
result=amount+rate;
cout.setf(ios::left);
cout<<setw(10)<<account<<setw(8)<<name<<setw(8)<<p ayment<<setw(10)<<amount<<setw(11)<<rate<<setw(12) <<result;
inpfle>>account>>name>>payment>>amount>>rate>>resu lt;
cout<<"\n";
}
getch();
main(); //to return from the start
inpfle.close();
// return 0;
} //end of case 2
break;
case 3: _cexit(); break;
default://note: cannot be used because break; in case 1 is removed
cout<<"I cannot understand"<<a;
}
} // end main
1 3036
- Lines 90 and 107, there's space in the variable name result.
- Line 105, there's space in the variable name payment.
- name is an int array. Maybe the datatype needs a change or the way the array variable is used.
illegal structure operation is my error please help guys thankyou
Post the environment/compiler details.
My guess is probably a deprecated/obsolete compiler is being used.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: tallpaul |
last post by:
I'm trying to run the following on an xp box.
import dbi, odbc
try:
s = odbc.odbc('DSN/username/userpassword')
cur = s.cursor()
cur.execute('select * from tablename')
print cur.description...
|
by: Kostatus |
last post by:
The following code worked perfectly fine until i modified an unrelated part
of the program:
this->dungArea.mBlocked =
mioS.mio_dungArea.mFlags & isBlocked;
after that i started getting the...
|
by: rkpatt |
last post by:
I am having problem with Access 2k and w98se . I am tying to create
new database using the wizards or templates . I get the error message
below when trying to use them . I've reinstalled the...
|
by: Jay |
last post by:
Hi,
This is Jay Mehta. I have this problem when using LDAP. I extract names
and EmailId's of all those present from LDAP and populate in a
datagrid.
Now when run locally, it is running...
|
by: cppcompiler1000 |
last post by:
when i was writing a program i got an error of " illegal structure operation" , in which situation compiler gives this type of error?
|
by: sumanpoonia |
last post by:
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
class complex
{
int real,imag;
public:
void read()
{
|
by: ketanharsoda |
last post by:
#include<iostream.h>
#include<conio.h>
class date
{
int dd,yy,day,*incr;
char *mon; //first latter
public:
void setptr(date *m);
void getdata();
|
by: sd99 |
last post by:
The question is to write C++ program using a function ( is_sorted() ) which takes a 1-D array and size as arguments, returns 1 if it is in ascending order, -1 if in descending order or else 0.
I...
|
by: Prathibha v |
last post by:
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
class sorting
{
private:int n,m;
public: void getdata();
void sort();
void display();
};
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
| |