1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
case ENTER:
{
int value=0;
bool y_n = false;
gotoXY(8+(x*7),5+(y*4), " ");
gotoXY(7,45,"Fill cell : ");
getline( cin, Fill_Cell);
int len = Fill_Cell.length()-1;
for(int a=0;a<len;a++)
if(Fill_Cell[a] == '.')
y_n = true;
if(Fill_Cell[0] == '=')
gotoXY(7,45,"Filling cell with Formula..");
else if (Fill_Cell[0]>='0' && Fill_Cell[0]<='9' && !y_n)
{
//Check for negative numbers later
gotoXY(7,45,"Filling cell with an integer of ");
istringstream convert(Fill_Cell);
// stringstream used for the conversion constructed with the contents of Fill_Cell'
// ie: the stream will start containing the characters of 'Fill_Cell'
convert >> value;
spreadsheet[x][y].num = value;
cout << spreadsheet[x][y].num;
}
else if (Fill_Cell[0]>='0' && Fill_Cell[0]<='9' && y_n)
{
gotoXY(7,45,"Filling cell with a float");
//spreadsheet[x][y].number = ??;
}
else if ((Fill_Cell[0]>='A' && Fill_Cell[0]<='Z') || (Fill_Cell[0]>='a' && Fill_Cell[0]<='z'))
{
gotoXY(7,45,"Filling cell with a some text - ");
spreadsheet[x][y].text = Fill_Cell;
cout << spreadsheet[x][y].text;
}
}
|