just plz 1) correct my faults and help me 2) on freazing the command by:getch(0) 3) where to put it and the include<conio.h>,plz i have a test tomorow on devcpp compiler:

#include<stdio.h>
void fill-mat(int x[10][10],n)
{
for(int i=0;i<n;i++)
for(int j=0;j<n;i++)
scanf("%d",&x[j]);
}
void print-mat(int x[10][10],n)
{
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
printf("%d",&x[j]);
}
void sort(int x[10][10])
{
int i,j,k,min;
for(i=0;i<n;i++)
for(j=0;j<n;j++)
{
min=x[j];
for(k=j+1;k<n;k++)
if(x[k]<min)
x[j]=x[k];
x[k]=min;
min=x[j];
}
}
int check(int a[10][10],int b[10][10])
{
int i,check=1;
for(i=0;i<n;i++)
for(j=0;j<n;j++)
if(a[j]!=b[j])
{
check=0;
break;
}
return check;
}
void main ()
{
int a[10][10],b[10][10],n;
scanf("%d",&n);
fill-mat(a);
fill-mat(b);
sort(a);
sort(b);
print-mat(a);
print-mat(b);
if(check(a,b)==1)
printf("indentical"); else  printf("unindentical");
}

Recommended Answers

All 3 Replies

i see none know the answer and ur telling me that there is profs well i have to rethink !!!!!
ok peaple thx 4 helping me none has answered me and it was good answer" i dont know the answer" lol

1) correct my faults.
Sorry too big a task. Specific questions are more likely to be answered. However, for starters I'll start here:

A) Posting code this board is a little tricky. You need to use code tags to keep the indentation I hope you used when writing the code. If the posted version is what it really looks like then you should first learn about indenting to make your life easier and improve your chances someones actually going to look a the code.

B) void main() is allowed on some compilers, not it's not portable. int main() is one less char to write, is much more portable, and is actually the standard.

C) This code is pure C. There's an entire board deisgned for this. This code should work in C++ too, so I'll give it my best shot, but you might try the C board if responses are slow here.

D) void fill-mat(int x[10][10],n)

Sorry, you can't declare mulitple int parameters/arguments like you can variables. This should be:

void fill-mat(int x[10][10], int n)

Ditto for all the other function definitions.

E) void sort(int x[10][10])
{}
int check(int a[10][10],int b[10][10])

What happened to n? You use it in each of these functions but it's not passed a parameter/argument like it is in the other functions. It should be.

F) sort() looks like a bubble sort done on each row of the table, though I don't know if that's what you want. Comments would help make things clearer, and the three lines after the if() probably belong in {}, though without knowing what you're actually trying to do I can't say that with certainty.

2) I guess I'd getch(0) just before the closing } in main(), if I was going to use it. Doing something of that sort is likely to be needed to keep the console window open to see the results of the information printed to the screen. Otherwise it's likely to print to the screen and terminate the program in the blink of an eye and you won't have a chance to see what was printed.

3) If you're going to use the nonstandard conio.h header file then include it below stdio.h

ok thank u know i think i am going to have a long period...... studying thx & see ya

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.