char formula [255];
char formula2[10][12];
from a file (
5CH3COOHyCH3COCH3yC9H13NO3yC4H10yCH3CH2CH2COOHy3CN yC8H18yC3H8y2NaClyC2H3Cl ) chemform.txt;
y- is to sparate the chemical formulas.
formula[] stores the chemical forums(chemform.txt)
formula2[k1,k2] -- k1 identify the forumula , k2 is stores the char. of k1.
/// init formula2[][]
for (k1=0; k1 < 10; k1++)
for (k2=0; k2 < 10; k2++)
{
formula2[k1][k2] = ' '; // dont know for sure
}
j =0; // an int
for ( i =0; i <strlen(formula); i++)
{
if (formula[i] = 'y')
{
j++;
/// // strcpy(formula2[j],formula);
}
else
formula2[j][i] = formula2[j][i] + formula[i];// something wrong
}