can't display the output! can somebody help me?!! PLS..

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2006
Posts: 38
Reputation: comp_sci11 is an unknown quantity at this point 
Solved Threads: 0
comp_sci11's Avatar
comp_sci11 comp_sci11 is offline Offline
Light Poster

can't display the output! can somebody help me?!! PLS..

 
0
  #1
Aug 1st, 2006
  1. #include<stdio.h>
  2. #include<string.h>
  3. #define size 21
  4. #define max 5
  5. int id[max][size];
  6. char ln[max];
  7. int pr[max];
  8. int mt[max];
  9. int fg[max];
  10.  
  11.  
  12. void getrecord()
  13. {
  14. int i;
  15. for(i=0;i<=4;i++)
  16. {
  17. clrscr();
  18. printf("id number:");
  19. scanf("%d",id[i]);
  20. printf("last name:");
  21. scanf("%s",ln[i]);
  22. printf("prelim:");
  23. scanf("%d",pr[i]);
  24. printf("midterm:");
  25. scanf("%d",mt[i]);
  26. fg[i]=(pr[i]*0.4)+(mt[i]*0.6);
  27. }
  28. getch();
  29. }
  30.  
  31. void displayreverse()
  32. {
  33. int i,p;
  34. clrscr();
  35. printf(" idno. lstnme prelim midterm fgrde");
  36. for(i=4;i<=0;i--);
  37. {
  38. p=0;p++;
  39. gotoxy(5,9+p);
  40. printf("%d",id[i]);
  41. gotoxy(5,9+p);
  42. printf("%s",ln[i]);
  43. gotoxy(5,9+p);
  44. printf("%d",pr[i]);
  45. gotoxy(5,9+p);
  46. printf("%d",mt[i]);
  47. gotoxy(5,9+p);
  48. printf("%d",fg[i]);
  49. }
  50. getch();
  51. }
  52.  
  53. main()
  54. {
  55. getrecord();
  56. displayreverse();
  57. exit(0);
  58. }
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 38
Reputation: comp_sci11 is an unknown quantity at this point 
Solved Threads: 0
comp_sci11's Avatar
comp_sci11 comp_sci11 is offline Offline
Light Poster

Re: can't display the output! can somebody help me?!! PLS..

 
0
  #2
Aug 1st, 2006
can someone help me??
this is a program i created wherein the function getrecord() accepts data up to 5 times and a displayreverse() wherein it display all the data from the last input to the first input.

it works but it doesn't display the output!

Is there something wrong in my displayreverse() function??
pls help me!!!! HELP!!!
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 1,496
Reputation: WolfPack has a spectacular aura about WolfPack has a spectacular aura about WolfPack has a spectacular aura about 
Solved Threads: 104
Moderator
WolfPack's Avatar
WolfPack WolfPack is offline Offline
Mentally Challenged Mod.

Re: can't display the output! can somebody help me?!! PLS..

 
0
  #3
Aug 1st, 2006
Please describe your problem a bit more. What are the errors that you are getting?
バルサミコ酢やっぱいらへんで
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 89
Reputation: dilip.mathews is an unknown quantity at this point 
Solved Threads: 3
dilip.mathews's Avatar
dilip.mathews dilip.mathews is offline Offline
Junior Poster in Training

Re: can't display the output! can somebody help me?!! PLS..

 
0
  #4
Aug 1st, 2006
Which compiler are you using???
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 38
Reputation: comp_sci11 is an unknown quantity at this point 
Solved Threads: 0
comp_sci11's Avatar
comp_sci11 comp_sci11 is offline Offline
Light Poster

Re: can't display the output! can somebody help me?!! PLS..

 
0
  #5
Aug 1st, 2006
i can't display the outputs.
like when i entered all the data 5times in the getrecord()
when it goes to the function displayreverse after inputing all the needed data, it does not display all the output. the output is just

" idno. lstnme prelim midterm fgrde"

and the inputted data didn't appear at all even though i entered all the data needed
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 89
Reputation: dilip.mathews is an unknown quantity at this point 
Solved Threads: 3
dilip.mathews's Avatar
dilip.mathews dilip.mathews is offline Offline
Junior Poster in Training

Re: can't display the output! can somebody help me?!! PLS..

 
0
  #6
Aug 1st, 2006
Here are some problem with your code

1)
  1. printf("last name:");
  2. scanf("%s",ln[i]);

replace it like
  1. printf("last name:");
  2. scanf("%s",ln);

2) The same problem with other scanf also. Give address to scanf.
ex :
  1. scanf("%d",&(pr[i]));
Last edited by dilip.mathews; Aug 1st, 2006 at 9:33 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 38
Reputation: comp_sci11 is an unknown quantity at this point 
Solved Threads: 0
comp_sci11's Avatar
comp_sci11 comp_sci11 is offline Offline
Light Poster

Re: can't display the output! can somebody help me?!! PLS..

 
0
  #7
Aug 1st, 2006
i'm using a borland turbo C
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 38
Reputation: comp_sci11 is an unknown quantity at this point 
Solved Threads: 0
comp_sci11's Avatar
comp_sci11 comp_sci11 is offline Offline
Light Poster

Re: can't display the output! can somebody help me?!! PLS..

 
0
  #8
Aug 1st, 2006
my problem is not in inputting the data, but in displaying the outputs.
like for example:

when i input all the data: like
id number:1
lastname:smith
prelim:60
midterm:100

id number:23
lastname:wirth
prelim:65
midterm:100

id number:3
lastname:smith
prelim:60
midterm:76

id number:3
lastname:taylor
prelim:55
midterm:15

id number7
lastname:scott
prelim:6
midterm:10

so i get a 5 inputs,and then after inputting it should display all these data in the screen.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 38
Reputation: comp_sci11 is an unknown quantity at this point 
Solved Threads: 0
comp_sci11's Avatar
comp_sci11 comp_sci11 is offline Offline
Light Poster

Re: can't display the output! can somebody help me?!! PLS..

 
0
  #9
Aug 1st, 2006
can someone help me??
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 1,496
Reputation: WolfPack has a spectacular aura about WolfPack has a spectacular aura about WolfPack has a spectacular aura about 
Solved Threads: 104
Moderator
WolfPack's Avatar
WolfPack WolfPack is offline Offline
Mentally Challenged Mod.

Re: can't display the output! can somebody help me?!! PLS..

 
0
  #10
Aug 1st, 2006
Try changing this part in displayreverse()
void displayreverse()
{
    int i,p;
    printf(" idno.  lstnme  prelim  midterm  fgrde");
    for(i=4;i>=0;i--);
    {
Please do not use clrscr, and gotoxy. Those functions are not standard functions. Since you are obviously a student, try to learn the correct usage of the C language. Modern compilers which are more standard compilant than TurboC does not compile your program. Search for the DevCPP compiler in google and download it. It is a very good compiler for beginners.
バルサミコ酢やっぱいらへんで
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 2573 | Replies: 19
Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC