Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

help with visual c++ - I keep getting errors

Status
Not open for further replies.

rapheal2k6

Newbie level 4
Joined
Feb 11, 2009
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,341
help with visual c++

hello, ive been trying to run this code on visual c++ but i keep getting some errors, please help me out.


the errors:
1>.\tu.cpp(6) : error C2006: '#include' : expected a filename, found 'using'
1>.\tu.cpp(6) : fatal error C1083: Cannot open include file: '': No such file or directory

and the code is:

#include<iostream.h>


#include<process.h>
#include "stdafx.h"
#include using namespace std;

int a[9][9]={0,0,9,0,0,0,0,2,0,
0,6,0,0,0,9,0,0,5,
0,0,0,8,7,0,0,0,0,
0,0,1,0,8,0,0,0,0,
0,4,0,5,0,7,1,3,0,
6,0,0,0,1,0,4,0,0,
0,0,0,0,4,8,2,0,0,
7,0,0,6,0,0,0,5,0,
0,9,0,0,0,0,8,0,0};
int b[9][9],k,l,m,z,flag=0,g,h;
int horizontal(int,int,int);
int vertical(int,int,int);
int box(int,int,int);
int assume(int,int);
void main()
{
//clrscr();
cout<<"enter values\n";
for(int i=0;i<9;i++)
for(int j=0;j<9;j++)
cin>>a[j];

for(i=0;i<9;i++)
for(j=0;j<9;j++)
b[j]=a[j];

for(i=0;i<9;i=i+1)
for(j=0;j<9;j=j+1)
{
//flag=0;
if(a[j]==0)
{
if(flag)
{
i=g;j=h;
flag=0;
}
if(assume(i,j)==2)
{
flag=1;
if(j==0)
{
h=8;
g=i;
g--;
}
else
{
g=i;
h=j;
h--;
}
if(a[g][h]!=0)
{
if(h==0)
{
h=8;
g--;
}
else
{
h--;
}
if(a[g][h]!=0)
{
if(h==0)
{
h=8;
g--;
}
else
{
h--;
}
if(a[g][h]!=0)
{
if(h==0)
{
h=8;
g--;
}
else
{
h--;
}
if(a[g][h]!=0)
{
if(h==0)
{
h=8;
g--;
}
else
{
h--;
}
}

}

}

}
}

}
}
for(i=0;i<9;i++)
{
for(j=0;j<9;j++)
cout<<b[j]<<"\t";
cout<<"\n";
}
//getch();
}


int horizontal(int i,int j,int z)
{
k=i;l=j;
for(j=0;j<9;j++)
{
if(j==l)
{
if(j==8)
break;
j++;
}
if((z==b[j]))
return 0;
}
return 1;
}
int vertical(int i,int j,int z)
{
k=i;
l=j;
for(i=0;i<9;i++)
{
if(i==k)
{
if(i==8)
break;
i++;
}
if((z==b[j]))
return 0;
}
return 1;
}
int box(int i,int j,int z)
{
k=i;
l=j;
if(i<=2&&j<=2)
{
for(int m=0;m<=2;m++)
{
for(int n=0;n<=2;n++)
{
if((k!=m&&l!=n)&&(z==b[m][n])) //checkout here
return 0;
}}
return 1;
}

else if(i<=2&&j<=5)
{
for(int m=0;m<=2;m++)
for(int n=3;n<=5;n++)
{
if(k==m&&l==n);
else if(z==b[m][n])
return 0;
}
return 1;
}

else if(i<=2&&j<=8)
{
for(int m=0;m<=2;m++)
for(int n=6;n<=8;n++)
{
if(k==m&&l==n);
else if(z==b[m][n])
return 0;
}
return 1;
}

else if(i<=5&&j<=2)
{
for(int m=3;m<=5;m++)
for(int n=0;n<=2;n++)
{
if(k==m&&l==n);
else if(z==b[m][n])
return 0;
}
return 1;
}

else if(i<=5&&j<=5)
{
for(int m=3;m<=5;m++)
for(int n=3;n<=5;n++)
{
if(k==m&&l==n);
else if(z==b[m][n])
return 0;
}
return 1;
}

else if(i<=5&&j<=8)
{
for(int m=3;m<=5;m++)
for(int n=6;n<=8;n++)
{
if(k==m&&l==n);
else if(z==b[m][n])
return 0;
}
return 1;
}

else if(i<=8&&j<=2)
{
for(int m=6;m<=8;m++)
for(int n=0;n<=2;n++)
{
if(k==m&&l==n);
else if(z==b[m][n])
return 0;
}
return 1;
}

else if(i<=8&&j<=5)
{
for(int m=6;m<=8;m++)
for(int n=3;n<=5;n++)
{
if(k==m&&l==n);
else if(z==b[m][n])
return 0;
}
return 1;
}

else if(i<=8&&j<=8)
{
for(int m=6;m<=8;m++)
for(int n=6;n<=8;n++)
{
if(k==m&&l==n);
else if(z==b[m][n])
return 0;
}
return 1;
}

return 1;
}

int assume(int i,int j)
{
m=b[j]+1;
while(1)
{
b[j]=m;
if(m>9)
{
b[j]=0;
return 2;
}
if(vertical(i,j,b[j]))
if(horizontal(i,j,b[j]))
if(box(i,j,b[j]))
{
b[j]=m;
return 0;
}
m++;
}
}
 

Re: help with visual c++

Read any book about C++ and namespaces.

Replace this line
#include using namespace std;

With this one:
using namespace std;
 

Re: help with visual c++

Dear ...
U have used #include using namespace std; which is totally wrong actually it will be using namespace std; because -

using namespace std;

All the elements of the standard C++ library are declared within what is called a namespace, the namespace with the name std. So in order to access its functionality we declare with this expression that we will be using these entities. This line is very frequent in C++ programs that use the standard library, and in fact it will be included in most of the source codes included in these tutorials.

and #include is usually used for including the Hidder files in ur program... it is called preprocessor directives

have a Good Day... [:)]
 

help with visual c++

well
open this file:

C:\Program files\Visual Studio\VC\header files

and check for header file names you have typed to see if they are exists.
 

help with visual c++

replace
#include using namespace std;
with
using namespace std;
in the fourth line

i hope it will work
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top