嘉祥初2016级18班吧 关注:11贴子:465
  • 8回复贴,共1

【one for all】free pascal程序展示

取消只看楼主收藏回复

1L壮哉我度娘~


1楼2013-12-03 13:33回复
    var
    a,n,s,i,b:integer;
    begin
    read(a,n);
    b:=a;
    s:=0;
    for i:=1 to n do
    begin
    s:=s+b;
    b:=10*b+a;
    end;
    write(s);
    end.
    题目:
    求和
    a+aa+aaa+aa..aa=?
    [n个a]


    3楼2014-01-19 21:14
    回复
      var
      a:char;
      b,c:integer;
      begin
      read(a);
      if a:='s' then b:=1;
      if a:='r' then b:=0;
      if a:='p' then b:=2;
      randomize;
      c:=random(3);
      if c=b then write('pingju')
      else if (c-b=1) or (c-b=-2) then write('you lose')
      else write('you win');
      end.
      【石头剪刀布】


      4楼2014-01-20 21:13
      收起回复
        var
        i:char;
        num1,num2:real;
        begin
        read(num1);
        read(i,i);
        read(num2);
        if i='+' then num2:=num1+num2
        else if i='-' then num2:=num1-num2
        else if i='*' then num2:=num1*num2
        else if i='/' then num2:=num1/num2;
        while i<>'=' do
        begin
        read(i,i);
        if i='=' then break;
        read(num1);
        if i='+' then num2:=num1+num2
        else if i='-' then num2:=num1-num2
        else if i='*' then num2:=num1*num2
        else if i='/' then num2:=num1/num2;
        end;
        write(num2:8:1);
        end.
        复杂的计算器问题,包括了多个运算符和多个运算量,为了简单起见,规定它按照输入的先后次序计算,而不考虑运算符的优先规则。如计算20+5*6+4+3/5=?,运算顺序为+*++/,考虑终止循环的条件是什么?与手工操作计算器


        6楼2014-01-26 21:08
        收起回复
          var
          a:array['a'..'z'] of integer;
          i:char;
          begin
          for i:='a' to 'z' do
          a[i]:=0;
          read(i);
          while i<>'.' do
          begin
          if (i>='a') and (i<='z') then
          a[i]:=a[i]+1;
          read(i);
          end;
          for i:='a' to 'z' do
          if a[i]<>0 then write(i,' ',a[i]);
          end.
          5、输入一段以句号结尾的英文,统计并输出句中各字母出现的次数。假设句中没有大写字母。


          12楼2014-03-05 13:51
          回复

            @朱智语 使用挽尊卡

            挽回他的尊严!

            效果:嘉祥初20...吧经验+1



            14楼2014-03-19 13:20
            回复
              var
              a:array[1..10,1..10] of integer;
              i,j:integer;
              begin
              a[1,1]:=1;
              for i:=2 to 10 do
              begin
              a[i,1]:=1;
              a[i,i]:=1;
              for j:=2 to i-1 do
              a[i,j]:=a[i-1,j-1]+a[i-1,j];
              end;
              for i:=1 to 10 do
              begin
              if i<>10 then write(' ':30-3*i);
              for j:=1 to i do write(a[i,j]:6);
              writeln;
              end;
              end.


              15楼2014-03-19 13:40
              收起回复
                const
                a=5
                x=record;
                name1:array[1..a] of string;
                number:array[1..a] of string;
                cj1,cj2,cj3,cj4:array[1..a] of real;
                end;
                var
                n,e:integer;
                b:integer;
                s:array[1..a] of real;
                pj:array[1..a] of real;
                i,j:integer;
                zz:array[1..7,1..5] of real;
                f:integer;
                begin
                for b:=1 to 5 do
                readln((x.name1[b]),(x.number[b]),(x.cj1[b]),(x.cj2[b]),(x.cj3[b]),(x.cj4[b]));
                s[a]:=(x.cj1[b])+(x.cj2[b])+(x.cj3[b])+(x.cj4[b]);
                pj:=s[a]/4;
                for n:=1 to a do
                for e:1 to a-1 do
                with x do
                if s[e] <s[e+1] then
                begin
                f:=s[e];
                s[e]:=s[e+1];
                s[e+1]:=f;
                end;
                for i:=1 to 7 do
                begin
                for j:=1 to 5 do
                begin
                with x do
                zz[1,j]:=name;
                zz[2,j]:=(cj1[b]);
                zz[3,j]:=(cj2[b]);
                zz[4,j]:=(cj3[b]);
                zz[5,j]:=(cj4[b]);
                zz[6,j]:=(zf[b]);
                zz[7,j]:=(pj(b));
                end;
                write(zz[i,j]);
                end;
                end.
                1、利用记录,输入四个姓名,性别,语文、数学、英语、物理的成绩,计算每个人的总分,平均分。最后按照总分从高到低的顺序打印输出所有人的信息。
                [有两个错待改--]
                @朱智语


                18楼2014-05-12 13:47
                回复
                  var
                  i,n,sum,num,pk,ai:integer;
                  f,t:string;
                  function check(a:integer):string;
                  begin
                  read(i);
                  f:='false';
                  t:='true';
                  if (i<=2) and (i mod 2<>0 then
                  check:=f
                  else if n<i then
                  ai:=trunc(sqrt(n));
                  for sum:=1 to ai do
                  if n mod ai=0 then
                  a:=i-n;
                  pk:=trunc(sqrt(a));
                  for num:=1 to pk do
                  if a mod num<>0
                  then check:=t
                  else check:=f;
                  write(check);
                  end.
                  哥德巴赫猜想[...还是有错]


                  19楼2014-05-19 13:42
                  回复