Click here to Skip to main content
15,885,953 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
AnswerRe: adding pointer arrays Pin
Richard MacCutchan30-Jul-15 21:26
mveRichard MacCutchan30-Jul-15 21:26 
GeneralRe: adding pointer arrays Pin
Member 935023730-Jul-15 21:51
Member 935023730-Jul-15 21:51 
GeneralRe: adding pointer arrays Pin
Richard MacCutchan30-Jul-15 22:16
mveRichard MacCutchan30-Jul-15 22:16 
GeneralRe: adding pointer arrays Pin
Member 935023730-Jul-15 23:16
Member 935023730-Jul-15 23:16 
GeneralRe: adding pointer arrays Pin
Richard MacCutchan30-Jul-15 23:42
mveRichard MacCutchan30-Jul-15 23:42 
GeneralRe: adding pointer arrays Pin
Member 935023731-Jul-15 0:34
Member 935023731-Jul-15 0:34 
GeneralRe: adding pointer arrays Pin
Richard MacCutchan31-Jul-15 0:36
mveRichard MacCutchan31-Jul-15 0:36 
QuestionDeclaration terminated incorrectly Pin
Pramitha P Kamath27-Jul-15 8:35
Pramitha P Kamath27-Jul-15 8:35 
My program is showing "Declaration Terminated incorrectly".Please help........
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<fstream.h>
#include<string.h>
#include<ctype.h>
void stock();
void billing();
class SBILL
{ int slno;
int itemcode;
char name[50];
float quantity;
float price;
float ttlprice;
float taxrate;
float amt;
public:
void subenter()
{ cout<<"\nEnter the following details:"
<<"\n\tItemCode\t:\n\t\t";
cin>>itemcode;
cout<<"\n\tName\t:\n\t\t";
gets(name);
cout<<"\n\tQuantity\t:\n\t\t";
cin>>quantity;
cout<<"\n\tTax rate\t:\n\t\t";
cin>>taxrate;
subcalculate();
}
void subdisplay()
{ cout<<"\n"<<slno<<"\t\t"<<name
<<"\t\t"<<quantity<<"\t\t"
="" <<price<<"\t\t"<<ttlprice
="" <<"\t\t"<<taxrate
="" <<"\t\t"<<amt;
="" }
="" void="" subcalculate()
="" {="" ttlprice="quantity*price;
" amt="((taxrate*ttlprice)/100)+ttlprice;
" int="" getcode()
="" return="" itemcode;
="" }
}sb;

class="" bills
{="" billcode;
="" char="" cusname[50];
="" float="" billamt;
="" public:
="" sbill="" sub;
="" enter()
="" cout<<"\nenter="" the="" following="" details:"
="" <<"\n\tbill="" code\t:\n\t\t";
="" cin="">>itemcode;
cout<<"\n\tCustomer name\t:\n\t\t";
gets(cusname);
void dis1()
{ cout<<"\nBILL CODE\t:"<<billcode
<<"\nname\t:"<<cusname
="" <<"\nslno.\t\t"<<"name\t\t"
="" <<"qty\t\t"<<"price\t\t"
="" <<"ttl\t\t"<<"txrt\t\t"<<"amt";
="" }
="" void="" dis2()
="" {="" cout<<"\n\n\t\tbill="" amount="" :"<<billamt;
="" calculatebamt(int="" x)
="" int="" i;
="" billamt="0;
" for(i="0;i<x;i++)
" getcode()
="" return="" code;
="" }
};

class="" stock
{="" slno;
="" sitemcode;
="" char="" sitemname[50];
="" float="" squantity;
="" sprice;
="" staxrate;
="" public:
="" enter()
="" cout<<"\nenter="" the="" following="" details:"
="" <<"\n\titem="" code\t:\n\t\t";
="" cin="">>sitemcode;
cout<<"\n\tItem Name\t:\n\t\t";
gets(sitemname);
cout<<"\n\tQuantity\t:\n\t\t";
cin>>squantity;
cout<<"\n\tPrice\t:\n\t\t";
cin>>sprice;
cout<<"\n\tTax rate\t:\n\t\t";
cin>>staxrate;
}
void display()
{ cout<<"\n"<<sitemcode<<"\t\t"<<sitemname
<<"\t\t"<<squantity<<"\t\t"
="" <<sprice<<"\t\t"<<staxrate;
="" }
="" void="" dis1()
="" {="" cout<<"\nslno.\t\t"<<"\ncde\t:"
="" <<"name\t\t"<<"qty\t\t"<<"price\t\t"
="" <<"txrt\t\t";
="" int="" getcode()
="" return="" sitemcode;
="" }
};

void="" main()
{="" clrscr();
="" choice;
="" char="" ch[5];
="" do
="" cout<<"\nplease="" enter="" your="" choice"
="" <<"\n\t1="" -="" stock"
="" <<"\n\t2="" billing";
="" cin="">>choice;
switch(choice)
{ case 1:stock();
break;
case 2:billing();
break;
default:cout<<"\nSome error occurred in your choice. Sorry for the inconvenience.\nPLEASE TRY AGAIN!!!";
}
cout<<"\n\nWould you like to continue? (Yes/No)";
cin>>ch;
ch=toupper(ch);
}while(ch=="YES");
getch();
}

void stock()
{ int stockchoice;
char chs[5];
do
{ STOCK ST,STK[30];
cout<<"\nPlease choose your operation"
<<"\n1 - To add stock"
<<"\n2 - To update details of a particular item"
<<"\n3 - To delete details of an existing item"
<<"\n4 - To display details of a particular item"
<<"\n5 - To display the entire bill details";
cin>>stockchoice;
switch(stockchoice)
{ case 1: ofstream fout;
int n,i;
fout.open("STOCK.DAT",ios::app||ios::binary);
cout<<"\nEnter the number of items";
cin>>n;
for(i=0;i<n;i++)
{="" stk[i].enter();
="" fout.write((char*)&stk[i],sizeof(stk[i]));
="" }
="" fout.close();
="" break;
="" case="" 2:="" fstream="" fout;
="" fout.open("stock.dat",ios::app||ios::binary);
="" int="" cde,flag="0;
" cout<<"\nenter="" the="" code="" of="" item="" whose="" details="" you="" want="" to="" update:\n";
="" cin="">>cde;
while(!fout.eof())
{ fout.read((char*)&ST,sizeof(ST));
if(getcode()==cde)
{ ST.enter();
fout.write((char*)&ST,sizeof(ST));
}
else
flag=1;
}
if(flag==1)
cout<<"\nSorry such an item does not exist";
fout.close();
break;
case 3: int cde,flag=0,i=0;
char nm[50];
fstream fin;
ofstream fout;
fin.open("STOCK.DAT",ios::in||ios::binary);
fout.open("TEMP.DAT",ios::out||ios::binary);
cout<<"\nEnter the name of the item you want to delete\n";
cin>>nm;
while(!fin.eof())
{ fin.read((*char)&ST,sizeof(ST));
if(ST.getname()==nm)
{ ST.dis1();
ST.slno=1;
ST.display();
fin.write((char*)&ST,sizeof(ST));
}
else
{ flag=1;
fout.write((char*)&ST,sizeof(ST));
}
}
if(flag==1)
cout<<"\nSorry the record was not found.";
fin.close();
fout.close();
remove("STOCK.DAT");
rename("TEMP.DAT","STOCK.DAT");
break;
case 4: int i=0;
char nm[50];
ifstream fin;
fin.open("STOCK.DAT",ios::in||ios::binary);
cout<<"\nEnter the item name you want to display\n";
cin>>nm;
while(!fin.eof())
{ fin.read((char*)&ST,sizeof(ST));
if(ST.getname()==nm)
{ ST.dis1();
ST.slno=1;
ST.display();
}
else
flag=1;
}
if(flag==1)
cout<<"\nSorry such an item does not exist.";
fin.close();
break;
case 5: ifstream fin;
fin.open("STOCK.DAT",ios::in||ios::binary);
fin.read((char*)&ST,sizeof(ST));
STK[0].slno=1;
ST.dis();
while(!fin.eof())
{ fin.read((char*)&ST,sizeof(ST));
ST.display();
ST.slno=ST.slno+1;
}
fin.close();
break;
default: cout<<"\nSome error occurred in your choice. Sorry for the inconvenience.\nPLEASE TRY AGAIN!!!";
}
cout<<"\nWould you like to continue? (Yes/No)";
cin>>chs;
}while(chs=="YES");
}

void billing()
{ int billchoice;
char chb[5];
do
{ BILLS BI;
BI.SUBBILL SUB,SB[10];
cout<<"\nPlease choose your operation"
<<"\n1 - To bill"
<<"\n2 - To search for an existing bill"
<<"\n3 - To display a bill"
<<"\n4 - To display the entire bill details";
cin>>billchoice;
switch(billchoice)
{ case 1: ofstream fout;
fout.open("BILL.DAT",ios::app||ios::binary);
int n;
cout<<"\nEnter the number of items";
cin>>n;
for(int i=0;i<n;i++)
{="" bi.sb[i].subenter();
="" bi.calculatebamt(n);
="" fout.write((char*)&bi,sizeof(bi));
="" }
="" fout.close();
="" break;
="" case="" 2:="" int="" cde,flag="0,i=0;
" ifstream="" fin;
="" fin.open("bill.dat",ios::in||ios::binary);
="" cout<<"\nenter="" the="" bill="" code="" you="" want="" to="" search\n";
="" cin="">>cde;
while(!fin.eof())
{ fin.read((char*)&BI,sizeof(BI));
if(BI.SUB.getcode()==cde)
{ BI.dis();
BI.SB[0].slno=1;
BI.SB[i].subdisplay();
}
else
flag=1;
}
if(flag==1)
cout<<"\nSorry the record was not found.";
fin.close();
break;
case 3: int cde;
ifstream fin;
fin.open("BILL.DAT",ios::in||ios::binary);
cout<<"\nEnter the bill code you want to display\n";
cin>>cde;
while(!fin.eof())
{ fin.read((char*)&BI,sizeof(BI));
if(BI.SB.getcode()==cde)
{ BI.SB.dis();
BI.SUB[0].slno=1;
BI.SB.subdisplay();
}
else
flag=1;
}
if(flag==1)
cout<<"\nSorry such a bill does not exist.";
fin.close();
break;
case 4: int cde,i=0;
ifstream fin;
fin.open("BILL.DAT",ios::in||ios::binary);
fin.read((char*)&BI,sizeof(BI));
BI.SB[0].slno=0;
BI.dis();
while(!fin.eof())
{ fin.read((char*)&BI,sizeof(BI));
BI.SB.display();
BI.SB.slno=SB.slno+1;
}
fin.close();
break;
default:cout<<"\nSome error occurred in your choice. Sorry for the inconvenience.\nPLEASE TRY AGAIN!!!";
}
cout<<"\nWould you like to add another bill? (Yes/No)";
cin>>chb;
chb=toupper(chb);
} while(chb=="YES");
}
AnswerRe: Declaration terminated incorrectly Pin
Wes Aday27-Jul-15 8:59
professionalWes Aday27-Jul-15 8:59 
GeneralRe: Declaration terminated incorrectly Pin
Pramitha P Kamath30-Jul-15 8:46
Pramitha P Kamath30-Jul-15 8:46 
AnswerRe: Declaration terminated incorrectly Pin
Richard MacCutchan30-Jul-15 21:14
mveRichard MacCutchan30-Jul-15 21:14 
Questionc++ Pin
Member 1184600721-Jul-15 21:43
Member 1184600721-Jul-15 21:43 
AnswerRe: c++ Pin
Richard MacCutchan21-Jul-15 21:53
mveRichard MacCutchan21-Jul-15 21:53 
GeneralRe: c++ Pin
Sascha Lefèvre25-Jul-15 12:39
professionalSascha Lefèvre25-Jul-15 12:39 
QuestionRe: c++ Pin
Paul Conrad13-Oct-15 7:20
professionalPaul Conrad13-Oct-15 7:20 
Questionc++ Pin
Member 1184600721-Jul-15 21:19
Member 1184600721-Jul-15 21:19 
GeneralRe: c++ Pin
Richard MacCutchan21-Jul-15 21:54
mveRichard MacCutchan21-Jul-15 21:54 
AnswerRe: c++ Pin
den2k8821-Jul-15 22:02
professionalden2k8821-Jul-15 22:02 
RantRe: c++ Pin
Richard Deeming22-Jul-15 1:22
mveRichard Deeming22-Jul-15 1:22 
QuestionAdd a dll file to using VC++ and use its functions Pin
ktnk19-Jul-15 3:03
ktnk19-Jul-15 3:03 
AnswerRe: Add a dll file to using VC++ and use its functions Pin
Richard Andrew x6419-Jul-15 6:00
professionalRichard Andrew x6419-Jul-15 6:00 
Questionc++ Pin
Member 1184600718-Jul-15 1:47
Member 1184600718-Jul-15 1:47 
AnswerRe: c++ Pin
OriginalGriff18-Jul-15 1:49
mveOriginalGriff18-Jul-15 1:49 
QuestionIs C++/CLI also open source with the new open source .Net? Pin
vickoza17-Jul-15 3:56
vickoza17-Jul-15 3:56 
AnswerRe: Is C++/CLI also open source with the new open source .Net? Pin
John Schroedl17-Jul-15 8:39
professionalJohn Schroedl17-Jul-15 8:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.