I designed the following<br>
pseudo code for a project I'm <br>
working on, I don't know much<br>
c++ so was wondering if n-e-1<br>
could translate:<br>
<br>
Open file "filename"<br>
Do until EOF:<br>
{<br>
i = i++<br>
Read Char<br>
If Char = "#"<br>
then <br>
{<br>
U<i>->flag = TRUE<br>
Char = NextChar<br>
}<br>
else U<i>->flag = FALSE<br>
Do until Char = ","<br>
{<br>
Read Char<br>
NumberString = NumberString + Char<br>
}<br>
U<i>->value = StrToInt(NumberString)<br>
<br>
Do until EOL<br>
{<br>
j = j++<br>
Read Char<br>
If Char = "#"<br>
then <br>
{<br>
W<i>[j]->flag = TRUE<br>
Char = NextChar<br>
}<br>
else W<i>[j]->flag = FALSE<br>
Do until Char = ","<br>
{<br>
Read Char<br>
NumberString = NumberString + Char<br>
}<br>
W<i>[j]->value = StrToInt(NumberString)<br>
}<br>
Goto NextLine<br>
}<br>
<br>
Example of what the code should do:<br>
Say I had text file such as:<br>
<br>
#0,#-0.1,0.2<br>
2,0.3,#0<br>
<br>
The code should read this and subsequently<br>
fill the data structures as follows:<br>
U[1]->flag = TRUE<br>
U[1]->value = 0<br>
W[1][1]->flag = TRUE<br>
W[1][1]->value = -0.1<br>
w[1][2]->flag = FALSE<br>
W[1][2]->value = 0.2<br>
U[2]->flag = FALSE<br>
U[2]->value = 2<br>
W[2][1]->flag = FALSE<br>
W[2][1]->value = 0.3<br>
w[2][2]->flag = TRUE<br>
W[2][2]->value = 0<br>
<br>
As you can see U and W are arrays.<br>
The elements of each array are<br>
also linked lists of flag(boolean)<br>
and value(double). U is a 1-D array<br>
while W is a 2-D array.
pseudo code for a project I'm <br>
working on, I don't know much<br>
c++ so was wondering if n-e-1<br>
could translate:<br>
<br>
Open file "filename"<br>
Do until EOF:<br>
{<br>
i = i++<br>
Read Char<br>
If Char = "#"<br>
then <br>
{<br>
U<i>->flag = TRUE<br>
Char = NextChar<br>
}<br>
else U<i>->flag = FALSE<br>
Do until Char = ","<br>
{<br>
Read Char<br>
NumberString = NumberString + Char<br>
}<br>
U<i>->value = StrToInt(NumberString)<br>
<br>
Do until EOL<br>
{<br>
j = j++<br>
Read Char<br>
If Char = "#"<br>
then <br>
{<br>
W<i>[j]->flag = TRUE<br>
Char = NextChar<br>
}<br>
else W<i>[j]->flag = FALSE<br>
Do until Char = ","<br>
{<br>
Read Char<br>
NumberString = NumberString + Char<br>
}<br>
W<i>[j]->value = StrToInt(NumberString)<br>
}<br>
Goto NextLine<br>
}<br>
<br>
Example of what the code should do:<br>
Say I had text file such as:<br>
<br>
#0,#-0.1,0.2<br>
2,0.3,#0<br>
<br>
The code should read this and subsequently<br>
fill the data structures as follows:<br>
U[1]->flag = TRUE<br>
U[1]->value = 0<br>
W[1][1]->flag = TRUE<br>
W[1][1]->value = -0.1<br>
w[1][2]->flag = FALSE<br>
W[1][2]->value = 0.2<br>
U[2]->flag = FALSE<br>
U[2]->value = 2<br>
W[2][1]->flag = FALSE<br>
W[2][1]->value = 0.3<br>
w[2][2]->flag = TRUE<br>
W[2][2]->value = 0<br>
<br>
As you can see U and W are arrays.<br>
The elements of each array are<br>
also linked lists of flag(boolean)<br>
and value(double). U is a 1-D array<br>
while W is a 2-D array.