If you have any questions, please state them clearly. Are you having problems with how to solve the problem, is the code not compiling, does the program crash, etc. etc.
Also, please put your code in between [code][/code]-tags, it makes it more readable.
Please clarify your question and I'm sure somebody will be happy to help you.
//diagonal.cpp
//print diagonal
#include <iostream>
using std::cout;
using std::endl;
int main(){
int diagonal=7;
for(int i=0;i<8;i++){
for(int j=0;j<8;j++){
if(j==diagonal) cout<<'1';
else cout<<'0';
}//end inner for
cout<<endl; //new line
diagonal--;
}//end outer for
return 0; //indicates success
}//end main
//diagonal.cpp
//print diagonal
#include <iostream>
using std::cout;
using std::endl;
int main(){
int diagonal=7;
for(int i=0;i<8;i++){
for(int j=0;j<8;j++){
if(j==diagonal) cout<<'1';
else cout<<'0';
}//end inner for
cout<<endl; //new line
diagonal--;
}//end outer for
cout<<'\n'<<endl;
for(int i=0;i<8;i++){
for(int j=0;j<8;j++){
if(i==j) cout<<'1';
else cout<<'0';
}//end inner for
cout<<endl; //new line
}//end outer for
return 0; //indicates success
}//end main
//diagonal.cpp
//print diagonal
#include <iostream>
using std::cout;
using std::endl;
int main(){
int diagonal=7;
for(int i=0;i<8;i++){
for(int j=0;j<8;j++){
if(j==diagonal||i==j) cout<<'1';
else cout<<'0';
}//end inner for
cout<<endl; //new line
diagonal--;
}//end outer for
return 0; //indicates success
}//end main