LAST ERROR IN PROECT

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;
}
.
.
.
.
.
.
.
.
.
.
.
//
Last edited on
In a "using" statement, you don't wrap the symbol you're using in quotes. So it should be:

using j;
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
is it readable now?

That's a big improvement - thanks. It would be even clearer if you adopted a sensible indentation style - that would help you see the flow of control in your code more clearly.

What are you trying to achieve by your using j statement? The point of a using statement is to pull entities from another namespace into the global namespace.
Topic archived. No new replies allowed.