Recent

Author Topic: [UNSOLVED] string variable expected  (Read 2198 times)

whitehat

  • Jr. Member
  • **
  • Posts: 93
[UNSOLVED] string variable expected
« on: January 11, 2017, 01:43:59 pm »
when i execute my programme there's a message show off  string variable expected

Code: Pascal  [Select][+][-]
  1. program ex;
  2. uses wincrt;
  3. type
  4. tab=array[1..3] of integer;
  5. taba=array [1..3] of integer;
  6. var
  7. a,b,c:integer;
  8. t:tab;
  9. ta:taba;
  10. procedure saisir (var t:tab);
  11. begin
  12. writeln('t[1]');
  13. readln(t[1]);
  14. writeln('t[2]');
  15. readln(t[2]);
  16. writeln('t[3]');
  17. readln(t[3]);
  18. end;
  19. procedure transfert (var ta:taba; t:tab);
  20. var
  21. a,b,c:integer;
  22. begin
  23. str(abs(t[1]),a);
  24. str(abs(t[2]),b);
  25. str(abs(t[3]),c);
  26. ta[1]:=length(a);
  27. ta[2]:=length(b);
  28. ta[3]:=length(c);
  29. end;
  30. procedure affiche (ta:taba);
  31. begin
  32. writeln('le nembre de chifre de l''entier num 1 =',ta[1]);
  33. writeln('le nembre de chifre de l''entier num 2 =',ta[2]);
  34. writeln('le nembre de chifre de l''entier num 3 =',ta[3]);
  35. end;
  36. begin
  37. saisir(t);
  38. transfert(ta,t);
  39. affiche(ta);
  40.  

rvk

  • Hero Member
  • *****
  • Posts: 6953
Re: [UNSOLVED] string variable expected
« Reply #1 on: January 11, 2017, 01:57:11 pm »
Is that your complete program? (can't imagine because I'm missing the end)
Is that your exact error message? (I get something else but the problem is the same)

On what line do you get that error message?
Did you check what that function does on that line (str()) ?
Look here: http://www.freepascal.org/docs-html/rtl/system/str.html
The second parameter should be string.

whitehat

  • Jr. Member
  • **
  • Posts: 93
Re: [UNSOLVED] string variable expected
« Reply #2 on: January 11, 2017, 02:00:45 pm »
oh thx u so mutch yeah a,b,c should be a string variable  :D

 

TinyPortal © 2005-2018