Forum: Pascal and Delphi Dec 6th, 2007 |
| Replies: 14 Views: 2,722 Man whatever I do I can not get my loop to read all the numbers. |
Forum: Pascal and Delphi Dec 6th, 2007 |
| Replies: 14 Views: 2,722 I am not sure If I am heading in the right direction, but this is what I got.
program Assignment7(input, output);
Type
pEquation = ^node;
node = record
numb... |
Forum: Pascal and Delphi Dec 5th, 2007 |
| Replies: 14 Views: 2,722 Ive taken a new approach to this assignment.
program Assignment7(input, output);
Type
pEquation = ^node;
node = record
numb : integer; |
Forum: Pascal and Delphi Dec 3rd, 2007 |
| Replies: 14 Views: 2,722 This is what I got
program Assignment7(input, output);
Type
pEquation = ^tequation;
tequation = record
kind : (i_am_a_number, i_am_an_operator); |
Forum: Pascal and Delphi Dec 2nd, 2007 |
| Replies: 14 Views: 2,722 Ugh. I am having troubles with "read the number and stick it in a new node" I can't seem to get it. Also, when you sau "c" is that the same as "my_char"
program Assignment7(input, output);
... |
Forum: Pascal and Delphi Dec 1st, 2007 |
| Replies: 14 Views: 2,722 Thats good to know. Am I still heading in the right direction to get all the digits out of the equation?
program Assignment7(input, output);
Type
pEquation = ^tequation;
tequation... |
Forum: Pascal and Delphi Dec 1st, 2007 |
| Replies: 14 Views: 2,722 I am not exactly sure how to get the numbers and operators from my equation into the linked lists? Can I use the function I had from my previous attempt at an assignment to get the numbers out of the... |
Forum: Pascal and Delphi Dec 1st, 2007 |
| Replies: 14 Views: 2,722 I don't think we learnt about variant records. As for the division. I think we are suppose to keep the division simple (no decimals). |
Forum: Pascal and Delphi Dec 1st, 2007 |
| Replies: 14 Views: 2,722 ยท The complete arithmetic expression will be read from a input file. An equation will not cover more than one line and may be assumed to be entirely valid.
The input file will contain a... |
Forum: Pascal and Delphi Nov 29th, 2007 |
| Replies: 62 Views: 11,549 Hey man, I totally appreciate all the help you've given me during this massive thread (and I have learnt stuff). But this assignment is due tomorrow, so I am just going to throw together what I have... |
Forum: Pascal and Delphi Nov 29th, 2007 |
| Replies: 62 Views: 11,549 I think it would be easiest to use an array of chars. Say this for example (if it works)
Var
myEquation : array[1..256] of char;
Equ : string[255];
... |
Forum: Pascal and Delphi Nov 29th, 2007 |
| Replies: 62 Views: 11,549 " Your program MUST use an array as the main storage medium for the equation " . So, I guess you need to use an array for the main storage but doesn't have to use an array all the time? |
Forum: Pascal and Delphi Nov 29th, 2007 |
| Replies: 62 Views: 11,549 Yes that is correct, " Every time an intermediate result is calculated the corresponding components of that calculation are removed from the array and replaced with the correct answer." is something... |
Forum: Pascal and Delphi Nov 29th, 2007 |
| Replies: 62 Views: 11,549 HMmm, it never said we had to. Another thing, the equation in the input file is assumed to be valid. So I don't have to worry about all the errors. |
Forum: Pascal and Delphi Nov 29th, 2007 |
| Replies: 62 Views: 11,549 I like the idea of that procedure, but I am not sure how to exactly write it up. When you declared equ : tEquationArray , do I need to make a type for this? Do I need to change the way I am reading... |
Forum: Pascal and Delphi Nov 28th, 2007 |
| Replies: 62 Views: 11,549 Yea man, I think I need to start all over using arrays :'(. All that work for nothing (i think).
So this is what I am thinking:
1. read from input file
2. Put the equation from input file into... |
Forum: Pascal and Delphi Nov 28th, 2007 |
| Replies: 62 Views: 11,549 Not sure what you mean here, I have temp_result := num1; ?
I am having enough trouble as it is trying to get this too work. And I also need to make my program do operator presedence and evaluate... |
Forum: Pascal and Delphi Nov 28th, 2007 |
| Replies: 62 Views: 11,549 Yea it makes sense, except whenever I try to find num2 (and all the digits after it) I just keep getting num1
case oper of
'+' : begin
num2 := find_digits(my_char,... |
Forum: Pascal and Delphi Nov 26th, 2007 |
| Replies: 62 Views: 11,549 I am lost trying to get num2 to equal the second digit, then the next time the loop is ran it equals the third digit? |
Forum: Pascal and Delphi Nov 26th, 2007 |
| Replies: 62 Views: 11,549 Ok, I messing around some more with my code and made it to give an output of 5 4 3 2 (where "5" is num1, and "4 3 2" are num2). I was trying to think of a way to put the numbers in an array but... |
Forum: Pascal and Delphi Nov 25th, 2007 |
| Replies: 2 Views: 2,839 Makes your program look nicer/shorter? |
Forum: Pascal and Delphi Nov 25th, 2007 |
| Replies: 62 Views: 11,549 Still having alittle troubles getting that the second digits. I came up with this
while (my_char <> '=') and (not eoln(my_file)) do
begin
ignorespaces(my_file, my_char);
... |
Forum: Pascal and Delphi Nov 25th, 2007 |
| Replies: 62 Views: 11,549 program Assignment6(input, output);
function convert(c: char): integer;
begin
convert := ord(c) - ord('0');
end; { convert }
function find_digits(var my_char : char; var my_file :... |
Forum: Pascal and Delphi Nov 25th, 2007 |
| Replies: 62 Views: 11,549 Ill think about it, I also HAVE to use arrays in this assignment. |
Forum: Pascal and Delphi Nov 24th, 2007 |
| Replies: 62 Views: 11,549 program Assignment6(input, output);
function convert(c: char): integer;
begin
convert := ord(c) - ord('0');
end; { convert }
function find_digits(var my_char : char; var my_file :... |
Forum: Pascal and Delphi Nov 24th, 2007 |
| Replies: 62 Views: 11,549 If I understand correctly, this is what I have
program Assignment6(input, output);
Var
error : boolean;
num1 : integer;
my_file : text;
my_char : char; |
Forum: Pascal and Delphi Nov 24th, 2007 |
| Replies: 62 Views: 11,549 AHHHHHHH i see now. Changing this stuff gives me a new error
program Assignment6(input, output);
Var
file1 : text;
c : char;
error : boolean;
num1 : integer;
function... |
Forum: Pascal and Delphi Nov 24th, 2007 |
| Replies: 62 Views: 11,549 program Assignment6(input, output);
Var
file1 : text;
c : char;
error : boolean;
num1 : integer;
function convert(c: char): integer;
begin
convert := ord(c) - ord('0'); |
Forum: Pascal and Delphi Nov 24th, 2007 |
| Replies: 62 Views: 11,549 Man I am just soo lost for this assignment. I keep trying different things but nothing works. This is what I got i guess.
program Assignment6(input, output);
Var
file1 : text;
c :... |
Forum: Pascal and Delphi Nov 24th, 2007 |
| Replies: 62 Views: 11,549 Man I am just soo lost for this assignment. I keep trying different things but nothing works. |
Forum: Pascal and Delphi Nov 21st, 2007 |
| Replies: 62 Views: 11,549 So basically I need to put the equations into an array, have a procedure that ignore spaces. Another procedure that will evaluate brackets first and so on. |
Forum: Pascal and Delphi Nov 20th, 2007 |
| Replies: 62 Views: 11,549 Ooh I see now.
But yea, my prof didn't really say anything about how we store the equation in the array :( |
Forum: Pascal and Delphi Nov 19th, 2007 |
| Replies: 62 Views: 11,549 So I started all over since I can't use records. What I wrote here wont compile.
program Assignment6(input, output);
Var
input : text;
... |
Forum: Pascal and Delphi Nov 19th, 2007 |
| Replies: 62 Views: 11,549 I got some bad news. I talked to my prof today and he doesn't want us to use records for this assignment. The next assignment will involve records. |
Forum: Pascal and Delphi Nov 18th, 2007 |
| Replies: 62 Views: 11,549 Man, you are great at explaining. I wish you were my prof :D
Everything was clear until this part
procedure string_to_equation( s: string; var equ: tEquation );
Ok, I understand I need to... |
Forum: Pascal and Delphi Nov 18th, 2007 |
| Replies: 62 Views: 11,549 I appreciate all the help. My prof is very confusing, and I don't think he is a good teacher at all. We did records last class but he didn't explain them very well. |
Forum: Pascal and Delphi Nov 18th, 2007 |
| Replies: 62 Views: 11,549 What do you mean? I dont really understand what you are doing here
type tType = (number, add, subtract, multiply, ...);
type tElement = record element_type: tType; number: integer end;... |
Forum: Pascal and Delphi Nov 17th, 2007 |
| Replies: 62 Views: 11,549 Something still isn't right, this is what I have
Program Lesson9_Program(input, output);
Type
Str25 = String[25];
tEquation = Record
num ... |
Forum: Pascal and Delphi Nov 17th, 2007 |
| Replies: 62 Views: 11,549 How do I put a record into an Array? Pretty lost for this. |
Forum: Pascal and Delphi Nov 16th, 2007 |
| Replies: 62 Views: 11,549 Thanks for all the info! Should I keep the code I have so far? Or should I start all over? |