Starting from:

$25

CS224 Assignment 1 Solved

1             Task 1
See the code as given Assignment01_SampleCode.cpp. Once you run the code, you can see that a file linegraph.txt is generated. You should now try to understand the code on your own and test it to see what happens when you make changes to it. Once understood, you are to produce a file, namely graph.txt which will contain a sine graph. For reference, kindly see graph.txt as given in the assignment folder.

2             Task 2
Suppose you are given any valid mathematical expression is a character array as given below:

 

char exp[] = "24*356+489*5/45*54";

 

write code such that you can separate the operands out as integers in a separate integer array and the operators in a separate character array. According to the case above, the integer array will contain the values:

       24                   356                   489                   5                   45                   54

and        the        character        array        will        contain        the        values:

        *                             +                             *                            /                            *

You can define the integer array and the character array of length 64. The code should work for any valid expressions showing a valid output. You do not need to calculate the expression but you can choose to do it as a challenge for yourself.

More products