fork download
  1. #include <iostream>
  2. #include <string.h>
  3. using namespace std;
  4.  
  5.  
  6.  
  7. #ifndef Header_h
  8. #define Header_h
  9. #include<iostream>
  10.  
  11.  
  12. using namespace std;
  13.  
  14.  
  15.  
  16. void korekta(char*tekst_in, char*tekst_out);
  17.  
  18.  
  19.  
  20. #endif
  21.  
  22.  
  23.  
  24. void korekta(char *tekst_in, char *tekst_out)
  25. {
  26.  
  27. cin.getline (tekst_in,6);
  28. int i_out=0;
  29. cout<<strlen(tekst_in)<<endl;
  30. for(int i=0; i<strlen(tekst_in)+1; i++)
  31. {
  32. if (tekst_in[i-1]==' ' && tekst_in[i]==' ')
  33. continue;
  34. else if(tekst_in[i-1]==' ' && tekst_in[i]==',')
  35. tekst_out[i_out-1]=',';
  36. else if(tekst_in[i-1]==' ' && tekst_in[i]=='.')
  37. tekst_out[i_out-1]='.';
  38. else
  39. {
  40. tekst_out[i_out]=tekst_in[i];
  41. i_out++;
  42. }
  43. }
  44.  
  45. for(int i=0; i<i_out; i++)
  46. cout<<tekst_out[i];
  47.  
  48. }
  49.  
  50.  
  51. int main() {
  52. char tekst_in[6];
  53. char tekst_out[6];
  54. korekta(tekst_in, tekst_out);
  55. return 0;
  56. }
Success #stdin #stdout 0s 3416KB
stdin
Standard input is empty
stdout
0