Wednesday, July 28, 2010

// add two matrices
int A[3][3];
int B[3][3];
int C[3][3];
for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++)
        cout << C[i][j] << " ";

int i =0;
++i

this means: (i = i+1, new value of i)

i++
this means: (temp = i, i = i+ 1, temp)

while(i = 0, i < 10, ++i)
    cout << i << " ";


void swap(int *a, int *b)
{
    int temp;
    temp = *a;
    *a = *b;
    *b = temp;
}

main()
{
    int x = 7;
    int y = 8;
    swap(&x, &y);
    cout << x << " " << y << endl;
}

No comments:

Post a Comment