473,396 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

can any one help me need urgently 2morow is TEST

7
hey
can any one help me in
i want to make a program in "C" in which user can enter a row , column and matrix(2D ARRAY) based on that row and column. that matrix should be diplayed
but the condition is
both insertion and deletion must be perform in two seperate function let say "insert" and "disp" and that func must be call in main

actully my program is not working properly its not giving me the right output

#include<conio.h>
#include<stdio.h>

void main()
{
static int m1[100][100];
int row1,col1;
int i,j;

printf("\n Enter the no. of rows and colomns of matrix : \n");
scanf(" %d %d",&row1,&col1);
printf("\nEnter the matrix elements : \n");

for(i=0;i<row1;i++)
{
for(j=0;j<col1;j++)
scanf("%d",&m1[i][j]);
}

printf("\nThe matrix you entered is : \n");
disp(m1,&row1,&col1);
getch();
}
disp(int *mat, int *row, int *col)
{
int i, j, r, c;
r=*row;
c=*col;

for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
printf("\n%d", *(mat+i*c+j) );
}
}
Nov 10 '06 #1
4 1198
sicarie
4,677 Expert Mod 4TB
hey
can any one help me in
i want to make a program in "C" in which user can enter a row , column and matrix(2D ARRAY) based on that row and column. that matrix should be diplayed
but the condition is
both insertion and deletion must be perform in two seperate function let say "insert" and "disp" and that func must be call in main

actully my program is not working properly its not giving me the right output

#include<conio.h>
#include<stdio.h>

void main()
{
static int m1[100][100];
int row1,col1;
int i,j;

printf("\n Enter the no. of rows and colomns of matrix : \n");
scanf(" %d %d",&row1,&col1);
printf("\nEnter the matrix elements : \n");

for(i=0;i<row1;i++)
{
for(j=0;j<col1;j++)
scanf("%d",&m1[i][j]);
}

printf("\nThe matrix you entered is : \n");
disp(m1,&row1,&col1);
getch();
}
disp(int *mat, int *row, int *col)
{
int i, j, r, c;
r=*row;
c=*col;

for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
printf("\n%d", *(mat+i*c+j) );
}
}
I'd start with getting rid of conio.h and getch(). They're useless and non-standard, so they won't port to any other systems that don't have your same version of conio.h (plus they dont' change the way your program operates, as far as I can see).

Then I'd match up your brackets - it looks like one of your functions is missing one.

Are you trying to declare a function disp(), or is that a call to stdio.h or ::shudder:: conio.h? I think that might be where you're missing your '}'
Nov 10 '06 #2
PINKA
7
I'd start with getting rid of conio.h and getch(). They're useless and non-standard, so they won't port to any other systems that don't have your same version of conio.h (plus they dont' change the way your program operates, as far as I can see).

Then I'd match up your brackets - it looks like one of your functions is missing one.

Are you trying to declare a function disp(), or is that a call to stdio.h or ::shudder:: conio.h? I think that might be where you're missing your '}'



thanks sir
but the thing is this program is not working properly actully when i call the func"disp" in main at that time the outpit shows bye this function only first row of matrix all other rows elements are zero. but the actully i hadn't insert zero any where like if i inser row =2 column=2 and matrix elent as 1, 2, 3, 4,
than it shows 1, 2, 0, 0,


so plese tell me where is my mistake and it would be best if you tell my mistake and show me through source code
Nov 11 '06 #3
PINKA
7
thanks sir
but the thing is this program is not working properly actully when i call the func"disp" in main at that time the outpit shows bye this function only first row of matrix all other rows elements are zero. but the actully i hadn't insert zero any where like if i inser row =2 column=2 and matrix elent as 1, 2, 3, 4,
than it shows 1, 2, 0, 0,


so plese tell me where is my mistake and it would be best if you tell my mistake and show me through source code
PLZZZZZZZZZZ HELP me
Nov 11 '06 #4
horace1
1,510 Expert 1GB
the simplest thing is to use array notation in function disp() rather than pointers, e.g.
Expand|Select|Wrap|Line Numbers
  1. #include<conio.h>
  2. #include<stdio.h>
  3.  
  4. int main()
  5. {
  6. static int m1[100][100];
  7. int row1,col1;
  8. int i,j;
  9.  
  10. printf("\n Enter the no. of rows and colomns of matrix : \n");
  11. scanf(" %d %d",&row1,&col1);
  12. printf("\nEnter the matrix elements : \n");
  13.  
  14. for(i=0;i<row1;i++)
  15. {
  16. for(j=0;j<col1;j++)
  17. scanf("%d",&m1[i][j]);
  18. }
  19.  
  20. printf("\nThe matrix you entered is : \n");
  21. disp(m1,&row1,&col1);
  22. getch();
  23. }
  24.  
  25. // specify number of elements in right most indicies
  26. disp(int mat[][100], int *row, int *col)  
  27. {
  28. int i, j, r, c;
  29. r=*row;
  30. c=*col;
  31.  
  32. for(i=0;i<r;i++)
  33. {
  34. for(j=0;j<c;j++)
  35.     printf("%d ", mat[i][j] );  // use array notation
  36. printf("\n");
  37. }
  38. }
  39.  
Nov 11 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Zeeshan | last post by:
Hi Everybody, I want to search the filename recursively for "this is the code original" using linux command grep or ls or any other Result should be as follows: FilenamePath and Linenumber in...
0
by: Kamliesh Nadar | last post by:
Hi I am developing a software using VB.NET I am facing following problems - 1. Though I have placed the NotifyIcon control on the window service application, after starting the service I am...
1
by: Dhiraj | last post by:
hello, everybody, this is Dhiraj here. I need help urgently, as i am getting error on my web page. The error is "Microsoft JET Database Engine error '80004005'" whenever i want to open links of...
1
by: net4matrimonials | last post by:
I m using session veriables of asp.net on two websites www.net4professionals.com(job site) and www.net4matrimonials.com (bride/groom service) when i create a session on page A i use codeing...
0
by: Asim Khan | last post by:
Dear all, A well reputable group of companies in Pakistan we urgently required a System Support Engineer for our sister concern factory located in Karachi at Korangi Industrial Area, Preference...
4
by: Flamingo | last post by:
Hi folks, I want a webpage, there would be a input textfield, and a "sumbit" button there, if you press the submit button, the contents you input to the textfield would be send to your...
0
by: efix | last post by:
hey there i need help urgently.. neone hu cud help me?? U c i m tryin t figure out how to program a vb .exe to login into a internet account inreal time. i m playin an online game....
1
by: neerajdeepak | last post by:
1) Display all the users currently logged in detail with column headers. 2)List all the files in current directory and save the list in a file ABC.Also save the contents of the files in ABC and...
2
by: rkarthik | last post by:
Hello vectors, I am a beginner in vb.net programming and a student. As my final year project I wish to develop a compression tool.Is there any way to impleiment Huffman's compression algorithm in...
16
by: techystud | last post by:
Hi, I am doing a Left Join between two views wherein the column used in the ON condition has empty string rows in the first view. while running the query the application flashes, shows #ERROR...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.