lonsomehell

poids_mot

May 4th, 2012
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.54 KB | None | 0 0
  1. program poids_mot;
  2. uses wincrt;
  3. var
  4. ch:string;
  5. n,i:integer;
  6. procedure poids(c:string;var k:integer);
  7. begin
  8. k:=0;
  9. for i:=1 to length(c) do
  10. begin
  11. if ch[i]='a' then k:=k+1*i
  12. else if ch[i]='e' then k:=k+5*i
  13. else if ch[i]='i' then k:=k+5*ord('i')
  14. else if ch[i]='o' then k:=k+5*ord('o')
  15. else if ch[i]='u' then k:=k+5*ord('u')
  16. else if ch[i]='y' then k:=k+5*ord('y')
  17. else k:=k;
  18. end;
  19. end;
  20. begin
  21. writeln('ecrire un mot');
  22. readln(ch);
  23. poids(ch,n);
  24. writeln('le poids du mot ',ch,' est: ',n);
  25. writeln('Press <Enter> To Quit');
  26.   readln();
  27. end.
Advertisement
Add Comment
Please, Sign In to add comment