Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Kopiranje teksta: Putchar i Getchar

[es] :: C/C++ programiranje :: Kopiranje teksta: Putchar i Getchar

[ Pregleda: 2527 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

Neverall

Član broj: 51734
Poruke: 268
*.cmu.carnet.hr.



Profil

icon Kopiranje teksta: Putchar i Getchar 22.07.2005. u 12:39 - pre 228 meseci
#include <stdio.h>
main()
{
int c;
while((c=getchar()) != EOF)
{

while (c!=' ')
{ putchar(c);
c=getchar();
}
c=getchar();
putchar();
}
}
OVAJ PROGRAM KOPIRA TEKST I NE ISPISUJE PRAZNINE.
KAKO DA PROGRAM KOPIRA TEKST I UKLONI PRAZNINE SAMO AKO IH IMA DVIJE ILI
VISE U NIZU..
Hvala!

Never
 
Odgovor na temu

rumpl

Član broj: 54959
Poruke: 156
*.com
Via: [es] mailing liste



Profil

icon Re: Kopiranje teksta: Putchar i Getchar 22.07.2005. u 13:49 - pre 228 meseci
Code:

#include <stdio.h>

int main(int argc, char **argv)
{
  int i;
  int c;
       
  i = 0;

  do
    {
      while ( (c = getchar()) == ' ')
    {
      if(i == 0)
        {
          putchar(c);
          i++;
        }
    }
      
      i = 0;

      putchar(c);
    }
  while( c != EOF );

  return(0);
}


Nadam se da si na ovo mislio, program ispisuje sve
razmake a ako ih ima vise, ispisuje samo jedan...
Pozdrav


Reality is an illusion that occurs due to lack of alcohol.




____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs
"The problem with the world is that everyone is a few drinks behind."
-Humphrey Bogart
 
Odgovor na temu

[es] :: C/C++ programiranje :: Kopiranje teksta: Putchar i Getchar

[ Pregleda: 2527 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.