Sep 1, 2014 at 10:01am UTC
Hello Everyone! my name is Raymond and I am 16 years old n I live in Kuwait.Our school does not teach us computer in depth so I wish to learn more about C++.Could anyone please help me to correct the one last error in my program.I compile using borlands C++
I get an error in the line "using "j" as shown below:-
[code]
#include<iostream.h>
#include<windows.h>
#include<dos.h>
#include<conio.h>
#include<cstring.h>
#include<ctype.h>
#include<stdlib.h>
#include<stdio.h>
#include<time.h>
#include<fstream.h>
{.
.
.
.
using "j" // ERROR:namespace name expected
gotoxy(7,14);cout<<"Enter the item no. of the item whosse details are to be changed";
input_num(itno,4);
fstream file("STORE.DAT",ios::binary|ios::in|ios::out);
while(file.read((char*)&ob,sizeof(ob)))
if(itno==ob.retno())
{
obn=ob;
gotoxy(10,17);ob.modify();
gotoxy(10,26);cout<<"ITEM NAME"<<"\tITEM NO"<<"\tTYPE"<<"\tRATE"<<"\tQTY\n";
gotoxy(10,27);cout<<"==== ===="<<"\t==== =="<<"\t ===="<<"\t===="<<"\t===\n";
gotoxy(10,28);obn.output();
gotoxy(10,30);cout<<"The item after modification is:-";
gotoxy(10,32);cout<<"ITEM NAME"<<"\tITEM NO"<<"\t TYPE"<<"\tRATE"<<"\tQTY\n";
gotoxy(10,33);cout<<"==== ===="<<"\t===\n";
gotoxy(10,34);ob.output();
file.seekp(-sizeof(ob),ios::cur);
file.write((char*)&ob,sizeof(ob));
flag=1;
break;
}
.
.
.
.
.
.
.
.
.
.
.
//
Sep 1, 2014 at 10:07am UTC
Last edited on Sep 1, 2014 at 10:08am UTC
Sep 1, 2014 at 1:25pm UTC
In a "using" statement, you don't wrap the symbol you're using in quotes. So it should be:
using j;
Sep 3, 2014 at 12:02am UTC
is it readable now?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
#include<iostream.h>
#include<windows.h>
#include<dos.h>
#include<conio.h>
#include<cstring.h>
#include<ctype.h>
#include<stdlib.h>
#include<stdio.h>
#include<time.h>
#include<fstream.h>
using j; // ERROR:namespace name expected
void input_num();
int main(){
gotoxy(7,14);cout<<"Enter the item no. of the item whosse details are to be changed" ;
input_num(itno,4);
fstream file("STORE.DAT" ,ios::binary|ios::in|ios::out);
while (file.read((char *)&ob,sizeof (ob)))
if (itno==ob.retno())}
void input_num(){
obn=ob;
gotoxy(10,17);ob.modify();
gotoxy(10,26);cout<<"ITEM NAME" <<"\tITEM NO" <<"\tTYPE" <<"\tRATE" <<"\tQTY\n" ;
gotoxy(10,27);cout<<"==== ====" <<"\t==== ==" <<"\t ====" <<"\t====" <<"\t===\n" ;
gotoxy(10,28);obn.output();
gotoxy(10,30);cout<<"The item after modification is:-" ;
gotoxy(10,32);cout<<"ITEM NAME" <<"\tITEM NO" <<"\t TYPE" <<"\tRATE" <<"\tQTY\n" ;
gotoxy(10,33);cout<<"==== ====" <<"\t===\n" ;
gotoxy(10,34);ob.output();
file.seekp(-sizeof (ob),ios::cur);
file.write((char *)&ob,sizeof (ob));
flag=1;
break ;
}
Last edited on Sep 3, 2014 at 12:14am UTC