is it true?!!

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

Join Date: May 2008
Posts: 10
Reputation: xlx16 is an unknown quantity at this point 
Solved Threads: 0
xlx16 xlx16 is offline Offline
Newbie Poster

is it true?!!

 
0
  #1
Jul 3rd, 2008
i want to make a text programe ,this program supposed to have a text mode and a command mode;
in text mode you can type and whit arrow key change your position
in command mode by typing your comman you can get the results for example:
by typing copy 2 3 5 the program will go to line 2 and then to character 3 and then counts 5 character and copies them in to anoter array (clipboard[][]),
a know that code bellow has lots of problems so i need your help
thank u,
  1. void text(char txt[20][4]){
  2. char ch;
  3. clrscr();
  4. gotoxy(45,0);
  5. printf("text mode");
  6. for(y=0;y<=4;)
  7. {
  8. for(i=0;i<=20;i++){
  9. ch=getch();
  10.  
  11. if (ch==13||ch==0)
  12. pos(ch);
  13.  
  14. putch(ch);
  15. txt[i][y]=ch;
  16. }//end of for
  17. y=y+1;
  18. }//end of outer for
  19. }
  20. //****************************
  21. void pos(char ch){
  22. if (ch==13){
  23. i=1;
  24. y=y+1;
  25. gotoxy(i,y);
  26. }
  27. else if(ch==0){
  28.  
  29. ch=getch();
  30. if(ch==77){
  31. i=i+1;
  32. gotoxy(i,y);
  33. }
  34. else if(ch==72){
  35. y=y-1;
  36. gotoxy(i,y);
  37. }
  38. else if(ch==80){
  39. y=y+1;
  40. gotoxy(i,y);
  41. }
  42. else if(ch==75){
  43. i=i-1;
  44. gotoxy(i,y);
  45. }
  46. }// end of first else if
  47. }
Last edited by Narue; Jul 3rd, 2008 at 8:45 am. Reason: Adde
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 79
Reputation: Adak is an unknown quantity at this point 
Solved Threads: 7
Adak Adak is offline Offline
Junior Poster in Training

Re: is it true?!!

 
0
  #2
Jul 3rd, 2008
Shouldn't your program have an int main() function, too?

Reply With Quote Quick reply to this message  
Reply

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


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC