what is the idea in this graph

Hello everybody

I am beginner in programming

my lecturer give a sample in C++ as the following graph :

http://www14.0zz0.com/2009/11/18/15/599417392.jpg

he want to change the green triangle with the second triangle

what is the idea ?

am wetting

make a 4*4 matrix, fill the values as shown in the cube, swap the values of red and green part.
what you say??
#include<stdio.h>
#include<conio.h>
void main(){
int i,j,k,l;
int mat[4][4]={00,01,10,11},{10,11,12,13},{20,21,22,23},{30,31,32,33};
for (i=0,j=0;j<4;j++)
{
for (k=3,l=3;l>=0;l--)
{
int t=mat[i][j];
mat[i][j]=mat[k][l];
mat[k][l]=t;
}
}
for (i=1,j=0;j<4;j++)
{
for (k=2,l=3;l>=0;l--)
{
int t=mat[i][j];
mat[i][j]=mat[k][l];
mat[k][l]=t;
}
}
//after this write code to print all the values, task achieved
getch();
}
1. Don't use conio.h
2. Don't use void main, main must return int.
3. Use [code] tags.
4. Don't do someone's homework for them.
5. Explain what you're doing. That code only contains one comment; and that's just to emphasise how much easier you've made OP's homework. All he has to do is write a couple of std::cout's and he's finished.

I can't read your code, it's illegible, so I don't even know if that's even correct.
I agree.
Topic archived. No new replies allowed.