I cannot compile my programming..abnormal programming..anybody whi knows where is my mistake?

{
int count, k;
{
count=0;
myfile<<"i,j|";
for ( int i = 1 ; i < students.size (); i++ )
for ( int k = 1;k<students.at(i).examcode.size(); k++ )
{
count=0;
for (int colHead = 1; colHead <students.at (i).examcode.at(k) ; colHead++)
{
myfile << setw(3) << colHead;
myfile << endl;
myfile <<"__________________________________"<<endl; 
}
}
for (int rowVal = 1; rowVal < students.at (i).examcode.at(k); rowVal++)	
{		
myfile << setw(3)<< rowVal <<'|'; 	
for (int colVal =1; colVal < students.at (i).examcode.at(k); colVal++)	
myfile<< setw(3)<<"x";	
myfile <<endl;
}		
}

Compiling...
142.cpp
C:\Documents and Settings\ashida\My Documents\MASTER C++\main\142.cpp(168) : warning C4508: 'main' : function should return a value; 'void' return type assumed
C:\Documents and Settings\ashida\My Documents\MASTER C++\main\142.cpp(106) : warning C4101: 'i' : unreferenced local variable
C:\Documents and Settings\ashida\My Documents\MASTER C++\main\142.cpp(106) : warning C4101: 'k' : unreferenced local variable
C:\Documents and Settings\ashida\My Documents\MASTER C++\main\142.cpp(155) : warning C4700: local variable 'k' used without having been initialized

142.obj - 0 error(s), 4 warning(s)

void main()

As for the others -- the compiler is complaining that you declared some variables but never used them. The solution is to delete those unused variables unless you intend to use them at some future time. In that case you can ignore those warnings.

Ok. I have make a corerction, but how to avoid from the repetition for i and k?

{
myfile<<"i,j|";
for ( int i = 1 ; i < students.size (); i++ )
{				
for ( int k = 1;k<students.at(i).examcode.size(); k++ )
{
for (int colHead = 1; colHead <students.at (i).examcode.at(k) ; colHead++)
myfile << setw(3) << colHead;
myfile << endl;
myfile <<"__________________________________"<<endl; 
for (int rowVal = 1; rowVal < students.at (i).examcode.at(k); rowVal++)	
{		
myfile << setw(3)<< rowVal <<'|'; 	
for (int colVal =1; colVal < students.at (i).examcode.at(k); colVal++)	
myfile<< setw(3)<<"x";	
myfile <<endl;
}
}
This article has been dead for over six months. Start a new discussion instead.