Message from C, C++ talks

May 2019

— User agent red has 1/3 warnings; be careful!
The latest warn was because:
you shall not ask for other languages

Message permanent page

— This program is right?

— Why not posting it to a service like pastebin?

— Shouldn't you tell us? Does it do what it is supposed to?

— 

Yup. He is right tho. Tell this group the problem and what should it do. So, they can give you some advice/answer

— Truly native C++ cross-platform framework for Android and iOS development
Article, Comments

— 😂🤣🤣

— 🤣🤣🤣

— Anyone to assist here on how to calculate the area of a circle by the use of C

— Lang

— This very easy Brother

— When it ask a number for the seccond time, it sets zero to all entries of my array instead of the expected result as oyu will see in the code. pls how can i solve it?

Message permanent page

— #include <stdio.h>
const int MAX=100;
int k=1;
//FILL ROW FOWARD
void FillRowFoward(int A[][MAX], int T, int L, int R, int K){
for (int i = L; i < R; i++)
A[T][i] = K++;
k=K;
}

//FILL COLUMN downward
void FillColumnDownward(int A[][MAX], int T, int B, int R, int K){
for (int i = T; i < B; ++i)
A[i][R-1] = K++;
k=K;
}


//FILL Row Bacward
void FillRowBackward(int A[][MAX], int B, int L, int R, int K){
for (int i = R-1; i >= L; --i)
A[B-1][i] = K++;
k=K;
}

//FILL Column Upward
void FillColumnUpward(int A[][MAX], int T, int B, int L, int K){
for (int i = B-1; i >= T; --i)
A[i][L] = K++;
k=K;
}


//MAIN FUNCTION
int main(void){
int N;
int TOP=0;
int LEFT=0;
int array[MAX][MAX];
do{
printf("enter the Row size or press zerro to quit: ");
scanf("%d", &N);
if(N==0) break;
else{
int BOTTOM=N;
int RIGHT=N;
while(k < N*N){//loop till k isleaa than N*N
//call of FILL ROW FOWARD
FillRowFoward(array, TOP, LEFT, RIGHT, k);
TOP += 1;

//call of FILL COLUMN downward
FillColumnDownward(array, TOP, BOTTOM, RIGHT, k);
RIGHT -=1;
// k +=RIGHT;

//call of FILL Row Bacward
FillRowBackward(array, BOTTOM, LEFT, RIGHT, k);
BOTTOM -=1;
// k +=BOTTOM;

//call of FILL Column Upward
FillColumnUpward(array, TOP, BOTTOM, LEFT, k);
LEFT +=1;
// k +=(BOTTOM -1);
}
int i,j,Lb;
for( Lb=0; Lb<=N; Lb++)
printf("----");
printf("\n");
for ( i=0; i<N; i++){
// printf("\nFFFF");
for ( j=0; j<N; j++)
if(array[i][j]<10)
printf(" %d |", array[i][j]);
else
printf(" %d |", array[i][j]);
printf("\n");
for( Lb=0; Lb<=N; Lb++)
printf("----");
printf("\n");
}
for(int b=0; b<N; b++)
for(int v=0; v<N; v++)
array[b][v]=0;
}}while(N!=0);
return 0;

}

Message permanent page

— Here is the output]

— As you see,,it works only for the first time.... then later gives garbage... i thnk its a problem of memory. but how do i solve it

Message permanent page