Subversion Repositories svnkaklik

Rev

Rev 263 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
263 kaklik 1
/////////////////////////////////////////////////////////////////
2
// Program opise zadany text az do chvile, nez narazi na tecku.
3
/////////////////////////////////////////////////////////////////
4
 
5
#include <stdlib.h>
6
#include <stdio.h>
7
 
8
 
9
int clear_buffer()
10
{ 
11
int i=0;
12
 
13
  while (getchar() != '\n') i++;
14
  return i;
15
}
16
 
17
 
18
int main()
19
{
20
 
21
int c;
22
 
23
  printf("Program po stisknutí Enteru opíše zadaný vstup \n");
24
 
25
 /*Prvni zpusob reseni */
26
  do
27
  {
28
    c=getchar();
29
	putchar(c);
30
  }
31
  while (c != '.');
32
 
33
  printf("\n Pocet smazanych znaku %d \n",clear_buffer()); 
34
 
35
  /* Druhy zpusob reseni*/
36
  while ((c=getchar()) != '.') putchar(c);
37
 
38
  printf("\n Pocet smazanych znaku %d \n",clear_buffer());
39
 
40
  /* treti zpusob reseni*/
41
  while(putchar(getchar()) != '.');
42
 
43
}