Advertisement
kit__kat

Untitled

Nov 20th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. /*netpbm.c*/
  2. #include <stdio.h>
  3.  
  4. int main()
  5. {
  6. int ch;
  7. int ch1;
  8.  
  9.  
  10. while((ch=getchar())!=EOF)
  11. {
  12. if(ch=='P'){
  13. putchar('P');
  14. ch=getchar(); //diavazei ton epomeno xarakthra dld to noumero
  15.  
  16.  
  17.  
  18. if (ch=='1'){
  19. printf("Input error!");
  20.  
  21. }
  22. if (ch=='2') {
  23. putchar('1');
  24. }
  25.  
  26. if(ch=='3') {
  27. putchar('2');
  28. }
  29. if(ch=='4'){
  30. printf("Input error!");
  31. }
  32.  
  33. if(ch=='5') {
  34. putchar('4');
  35. }
  36.  
  37. if(ch=='6') {
  38. putchar('5');
  39. }
  40. ch1=ch;
  41.  
  42. }
  43.  
  44.  
  45. while(ch ==' ' || ch=='\t' || ch=='\n'); //lefkoi xarakthres
  46. {
  47. ch=getchar();
  48. putchar(ch);
  49. }
  50.  
  51. if(ch=='#') //sxolia
  52. {
  53. do{
  54. ch=getchar();
  55. putchar(ch);
  56. } while(ch!='\n');
  57. }
  58.  
  59. while(ch!=' ' && ch!='\t' && ch!='\n'); //platos
  60. {
  61. ch=getchar();
  62. putchar(ch);
  63. }
  64.  
  65. if(ch==' ' || ch=='\t' || ch=='\n') //leykos xarakthras
  66. {
  67. ch=getchar();
  68. putchar(ch);
  69. }
  70.  
  71. while(ch!=' ' && ch!='\t' && ch!='\n'); //height
  72. {
  73. ch=getchar();
  74. putchar(ch);
  75. }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement