c# 4.0 - Unable to convert this Pascal code to C# -


i don't know pascal, that's why asking. maybe it's created file , write there there pascal code

program writefile; uses crt; var dur,ts,tv,n,vers,i : integer;     x,filename : string[12];     f : file of integer; begin   clrscr;   write('variant=');   readln(vers);   write('number of works=');    readln(n);   str(vers,x);   filename:='shed'+x+'.tab';   assign(f,filename);    rewrite(f);   i:=1 n     begin writeln(i,'-th work:');     write('time of beginning=');     readln(ts);     write('during=');      readln(dur);     tv:=ts+dur;     write(f,ts,dur,tv)     end;   close(f) end. 

i think that:

static void main(string[] args)     {         console.clear(); //unnecessary         console.write("variant=");             int vers = int32.parse(console.readline());         console.write("number of works=");             int n = int32.parse(console.readline());          string x = vers.tostring();         string filename = "shed" + x + ".tab";         //or string filename = "shed" + vers.tostring() + ".tab"; //without unnecessary x variable          system.io.file.writealltext(filename, string.empty); //clear file          system.io.streamwriter file = new system.io.streamwriter(filename);         int ts;         int dur;         int tv;          (int = 0; < n; i++)         {             console.writeline(i.tostring() + "-th work:");             console.write("time of beginning=");             ts = int32.parse(console.readline());             console.write("during=");             dur = int32.parse(console.readline());             tv = ts + dur;              file.writeline(ts.tostring() + "\t" + dur.tostring() + "\t" + tv.tostring());         }          file.close();     } 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -