Phoenix Posted January 11, 2007 Share Posted January 11, 2007 Got something like this...but this is borland pascal.. ;)program Numbers;uses crt;var a, b, c: integer;begin clrscr; write('Give 3 numbers: '); readln(a, b,c); if a > b then begin b := a + b; a := b - a; b := b - a end; if a > c then begin c := a + c; a := c - a; c := c - a end; if b > c then begin c := c + b; b := c - b; c := c - b end; writeln(a:2, b:2, c:2); readlnend.or more like this:{}PROGRAM study2;USES crt;const max = 10;var number2: real;{TYPES}type tString10 = string[10]; tDate = record year :integer; month :1..12; day :1..31 end; tStudent = record studentnumber :tString10; studentname :tString10; education :tString10 end; tModule = record modulenumber :tString10; modulename :tString10; semesternumber :tString10 end; ttest = record modulenumber :tString10; studentnumber :tString10; date :tdate; result :real end; tTabelstudent = array[1..max] of tStudent; tTabelmodule = array[1..max] of tModule; tTabeltest = array[1..max] of ttest;{PROCEDURES}procedure read_in_student(var input: text; var tabel: tTabelstudent; var length: integer);begin clrscr; reset(input); length := 0; while not eof(input) do begin length := length + 1; read(input, tabel[length].studentnumber); read(input, tabel[length].studentname); read(input, tabel[length].education); readln(input) endend;procedure write_student(var tabel: tTabelstudent; length: integer);var i :integer;begin for i := 1 to length do begin write(tabel[i].studentnumber); write(tabel[i].studentname); write(tabel[i].education); writeln end; writelnend;procedure read_in_module(var input: text; var tabel: tTabelmodule; var length: integer);begin reset(input); length := 0; while not eof(input) do begin length := length + 1; read(input, tabel[length].modulenumber); read(input, tabel[length].modulename); read(input, tabel[length].semesternumber); readln(input) endend;procedure write_module(var tabel: tTabelmodule; length: integer);var i :integer;begin for i := 1 to length do begin write(tabel[i].modulenumber); write(tabel[i].modulename); write(tabel[i].semesternumber); writeln end; writelnend;procedure read_in_test(var input: text; var tabel: tTabeltest; var length: integer);begin reset(input); length := 0; while not eof(input) do begin length := length + 1; read(input, tabel[length].modulenumber); read(input, tabel[length].studentnumber); read(input, tabel[length].date.year); read(input, tabel[length].date.month); read(input, tabel[length].date.day); read(input, tabel[length].result); readln(input) endend;procedure write_test(var tabel: tTabeltest; length: integer);var i :integer;begin for i := 1 to length do begin write(tabel[i].modulenumber); write(tabel[i].studentnumber); write(tabel[i].date.year:5); write(tabel[i].date.month:3); write(tabel[i].date.day:3); write(tabel[i].result:6:1); writeln end; writelnend;procedure show_result(nameinput: tString10; modulenameinput: tString10;length1, length2, length3: integer; var tabel1: tTabelstudent; var tabel2: tTabelmodule; var tabel3: tTabeltest);var i, ii: integer; studentnametemp, modulenametemp, modulenumbertemp, studentnumbertemp: string[10];begin for i := 1 to length1 do if nameinput = tabel1[i].studentname then begin studentnametemp := tabel1[i].studentname; studentnumbertemp := tabel1[i].studentnumber end; for ii := 1 to length2 do if modulenameinput = tabel2[i].modulename then begin modulenametemp := tabel2[i].modulename; modulenumbertemp := tabel2[i].modulenumber; for ii := 1 to length3 do if (studentnumbertemp = tabel3[ii].studentnumber) and (modulenumbertemp = tabel3[ii].modulenumber) then writeln(studentnumbertemp, modulenumbertemp, tabel3[ii].result) end; modulenumbertemp := 'false';end;Procedure write_result(nameinput: tString10; modulenameinput: tString10; studentnametemp: tString10;modulenumbertemp: tString10;length1, length2, length3: integer; var tabel1: tTabelstudent; var tabel2: tTabelmodule; var tabel3: tTabeltest);var ii: integer; begin write(studentnametemp); write(modulenumbertemp); write(tabel3.result) endend;{MAINPROGRAMMA}VAR inputtext1, inputtext2, inputtext3 :text; ylength1, ylength2, ylength3 :integer; tabelstudent : tTabelstudent; tabelmodule : tTabelmodule; tabeltest : tTabeltest; tabel3 : tTabeltest; nameinput, modulenameinput, studentnumbertemp, modulenumbertemp : String[10]; result : real;BEGIN clrscr; assign(inputtext1, 'student.txt'); assign(inputtext2, 'module.txt'); assign(inputtext3, 'test.txt'); number2 := 0; read_in_student(inputtext1, tabelstudent, ylength1); write_student(tabelstudent, ylength1); read_in_module(inputtext2, Tabelmodule, ylength2); write_module(tabelmodule, ylength2); read_in_test(inputtext3, tabeltest, ylength3); write_test(tabeltest, ylength3); writeln('Studentname: '); readln(nameinput); writeln('Modulename: '); readln(modulenameinput); show_result(nameinput, modulenameinput, ylength1, ylength2, ylength3, Tabelstudent, Tabelmodule, Tabeltest); writeln;readlnEND.ah yeah, this program reads from some files (student.txt, module.txt and test.txt) and you can request some info according test results and such things..gryphon might know this one ;) Quote Link to comment Share on other sites More sharing options...
Timenn Posted January 11, 2007 Share Posted January 11, 2007 Why don't people ever ask for help with economics instead?Face it, it's dull... :PDoing CS myself, and I must say this is one weird assignment. We usually were warned not to program such repetitions of code, but instead call the same code multiple times.Better make copies of one working program, and change a few things in each program, than finding them all on the internet. (On a side note, iteration sucks once you've learned of the powers of recursion ;)) Quote Link to comment Share on other sites More sharing options...
exatreide Posted January 11, 2007 Share Posted January 11, 2007 Well if anyone needs help in Q basic, you can ask me. Quote Link to comment Share on other sites More sharing options...
Edric O Posted January 12, 2007 Share Posted January 12, 2007 Face it, it's dull... :P One of my economics professors in college told us about the time he was forced to read Milton Friedman's "A Monetary History of the United States" back when he was a student. It's over 800 pages and discusses the evolution of the money supply (yes, the money supply) in the United States from 1867 to 1960. He described it as causing "such an intense feeling of boredom that your synapses want to commit ritual suicide".So, yeah, econ can be a little dull at times, but I like it. :P Quote Link to comment Share on other sites More sharing options...
Andrew Posted January 12, 2007 Share Posted January 12, 2007 Econ can be boring and interesting. Some econ books put me to sleep, others I don't mind reading. My prof is going to Asia (maybe sri lanka) for some economic development conference or something, so no classes for two weeks in it :D Quote Link to comment Share on other sites More sharing options...
Phoenix Posted January 14, 2007 Share Posted January 14, 2007 Econ can be boring and interesting. Some econ books put me to sleep, others I don't mind reading. My prof is going to Asia (maybe sri lanka) for some economic development conference or something, so no classes for two weeks in it :Dsee economics classes can also have some advantages.. :D Quote Link to comment Share on other sites More sharing options...
Egeides Posted January 15, 2007 Share Posted January 15, 2007 I absolutely loooove money supply!! I've just listened to some Friedman video a month ago, about money supplies and more... the most interesting was Friedman's rhetoric given how uninstructive he was on supplies but oh well ;D[hide]/me dreams of supplies... money supplies, oil supplies... SPICE supplies. Who controls spice...[/hide]very interesting indeed ;) Quote Link to comment Share on other sites More sharing options...
piterdevries Posted January 15, 2007 Author Share Posted January 15, 2007 anyway i managed to finish it,, well almost.. thanks re-erjin for the link, and to all others who helped. thanks! Quote Link to comment Share on other sites More sharing options...
erjin999 Posted January 15, 2007 Share Posted January 15, 2007 No probs. I used to use that site as it has some very useful (and some not) snippets of code. Quote Link to comment Share on other sites More sharing options...
piterdevries Posted March 9, 2007 Author Share Posted March 9, 2007 here i am again,,, this time that prof of mine gave us a project that would leave us exempted in the final exams if we ever manage to make it...he said that this program must display a word, for example Dune.Then a colored dash ( - ) or any other symbol must march around that word (just like Microsoft Word's marching red ants effect).. help me guys. just give me an idea on how to do it.... thanks a lot Quote Link to comment Share on other sites More sharing options...
Phoenix Posted March 23, 2007 Share Posted March 23, 2007 Just print 3 lines-"word"and then print -"word"...and then print"word"|etc..something like the moving * in dos. which actually is | - / | printed over each other all the timegood luck ;) Quote Link to comment Share on other sites More sharing options...
erjin999 Posted March 24, 2007 Share Posted March 24, 2007 Thats a very good simple answer. I was thinking it would take some doing, which is why I didnt reply :P Quote Link to comment Share on other sites More sharing options...
Phoenix Posted March 25, 2007 Share Posted March 25, 2007 just read a line of text and print it :Pvar a="string"readln(a)print (color=red)_print aprint Quote Link to comment Share on other sites More sharing options...
alchemi2 Posted March 26, 2007 Share Posted March 26, 2007 Is it just me that has a moral objection to doing someone else's homework, apart from the the fact that no one ever offered to do mine for me. ::) ;) Quote Link to comment Share on other sites More sharing options...
erjin999 Posted March 26, 2007 Share Posted March 26, 2007 Helping fellow humans, alchi.Boy asks sister "Will you do my homework for me ?"Sister says "No, it wouldnt be right"Boy replies "Yes, you probably wouldnt get it right"Or something like that. God I cant tell a joke to save my life. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.