I am getting this weird issue on my CG-10 where when it gets to a certain point, it freezes up and I have to pull the batteries out to turn it off.
This is my first time using Prizm SDK, but I have programmed quite a bit of C++ in the past (Close enough to C, but I haven't programmed C++ within 9 months but i'm not too rusty).
I am creating a program that will take an input integer, create an array of that size, request values for each element, and then perform forecast predictions on the values (think financing, and each element represents a month, and there are multiple different ways I want to "predict" a specific month).
I think my program is getting hung up around line 133 ("while(i<ARRAY_SIZE){"), where ARRAY_SIZE is an int derived from an int value in a struct (confusing to explain, but I couldn't find any online resources that would have helped me to make it easier).
Here is my code so far (line 133 has a row of forward-slashes right before it, to assist in identification):
Code:
I was pretty sure I had everything down pat, but if I messed up somewhere, I would greatly appreciate assistance. Thanks[/code]
This is my first time using Prizm SDK, but I have programmed quite a bit of C++ in the past (Close enough to C, but I haven't programmed C++ within 9 months but i'm not too rusty).
I am creating a program that will take an input integer, create an array of that size, request values for each element, and then perform forecast predictions on the values (think financing, and each element represents a month, and there are multiple different ways I want to "predict" a specific month).
I think my program is getting hung up around line 133 ("while(i<ARRAY_SIZE){"), where ARRAY_SIZE is an int derived from an int value in a struct (confusing to explain, but I couldn't find any online resources that would have helped me to make it easier).
Here is my code so far (line 133 has a row of forward-slashes right before it, to assist in identification):
Code:
#include <fxcg/keyboard.h >
#include <fxcg/display.h>
#include <CONVERT_syscalls.h>
#define true 1
#define false 0
struct VALUE_GROUP {
double Value_Complete;
int Value_Whole;
int Value_Decimal;
int Whole_Digit_Count;
int Decimal_Digit_Count;
char Char_Value_Whole[14];
char Char_Value_Whole_2[14];
char Char_Value_Decimal[14];
char Char_Value_Decimal_2[14];
};
void print(char cmd,int x,int y, int val){
if(cmd == 'x')PrintXY(x,y,"-- ", TEXT_MODE_NORMAL, TEXT_COLOR_BLACK);
else if(cmd == 'i'){
char out[14];
itoa(val,(unsigned char*)out+2);
PrintXY(x,y,out, TEXT_MODE_NORMAL, TEXT_COLOR_BLACK);
}
}
void print_int(int value,int line){
char char_val[14];
}
struct VALUE_GROUP KeyToNum(int printWhile){
struct VALUE_GROUP Return_Value;
Return_Value.Value_Complete=0;
Return_Value.Value_Whole=0;
Return_Value.Value_Decimal=0;
Return_Value.Whole_Digit_Count=1;
Return_Value.Decimal_Digit_Count=0;
int decimals = 1;
int input;
int active = true;
while(active){
int value = 0, valid = false;
GetKey(&input);
if(input == KEY_CTRL_EXE){
active = false;
}else if(input == KEY_CHAR_0){
value = 0; valid = true;
}else if(input == KEY_CHAR_1){
value = 1; valid = true;
}else if(input == KEY_CHAR_2){
value = 2; valid = true;
}else if(input == KEY_CHAR_3){
value = 3; valid = true;
}else if(input == KEY_CHAR_4){
value = 4; valid = true;
}else if(input == KEY_CHAR_5){
value = 5; valid = true;
}else if(input == KEY_CHAR_6){
value = 6; valid = true;
}else if(input == KEY_CHAR_7){
value = 7; valid = true;
}else if(input == KEY_CHAR_8){
value = 8; valid = true;
}else if(input == KEY_CHAR_9){
value = 9; valid = true;
}else if(input == KEY_CHAR_DP){
if(decimals==1){
decimals*=10; valid = true;
}
}
if(valid && active){
if(decimals == 1){
Return_Value.Value_Whole=(Return_Value.Value_Whole*10)+value;
Return_Value.Whole_Digit_Count++;
}else if(decimals>1){
Return_Value.Value_Decimal=(Return_Value.Value_Decimal*10)+value;
if(Return_Value.Value_Decimal>0){
Return_Value.Decimal_Digit_Count++;
decimals*=10;
}
}
itoa(Return_Value.Value_Whole,(unsigned char*)Return_Value.Char_Value_Whole);
itoa(Return_Value.Value_Whole,(unsigned char*)Return_Value.Char_Value_Whole_2 + 2);
if(decimals>1){
itoa(Return_Value.Value_Decimal,(unsigned char*)Return_Value.Char_Value_Decimal);
itoa(Return_Value.Value_Decimal,(unsigned char*)Return_Value.Char_Value_Decimal_2 + 2);
}
if(printWhile){
PrintXY(1,8,Return_Value.Char_Value_Whole_2,0,TEXT_COLOR_BLACK);
if(decimals>1){
PrintXY(Return_Value.Whole_Digit_Count,8," .",0x20,TEXT_COLOR_BLACK);
if(Return_Value.Decimal_Digit_Count>0)PrintXY(Return_Value.Whole_Digit_Count+1,8,Return_Value.Char_Value_Decimal_2,0x20,TEXT_COLOR_BLACK);
}
}
}
}
Return_Value.Value_Complete=Return_Value.Value_Whole+(Return_Value.Value_Decimal/decimals);
return Return_Value;
}
void main(void) {
int event = true, i = 0;
int input;
PrintXY(1,1,"--Enter Length:", TEXT_MODE_NORMAL, TEXT_COLOR_BLACK);
struct VALUE_GROUP ARRAY_SIZE_GROUP = KeyToNum(1);
int ARRAY_SIZE = ARRAY_SIZE_GROUP.Value_Whole;
struct VALUE_GROUP ARRAY_GROUP[ARRAY_SIZE];
double ARRAY[ARRAY_SIZE];
i=0;
while(i<ARRAY_SIZE){
Bdisp_AllClr_VRAM();
PrintXY(1,1,"--Enter Value: ", TEXT_MODE_NORMAL, TEXT_COLOR_BLACK);
print('i',14,1,i+1);
ARRAY_GROUP[i]=KeyToNum(1);
ARRAY[i]=ARRAY_GROUP[i].Value_Complete;
i++;
}
event = true;
while (event) {
Bdisp_AllClr_VRAM();
PrintXY(1,1,"--What Do:", TEXT_MODE_NORMAL, TEXT_COLOR_BLACK);
PrintXY(3,2,"--1. View List:", TEXT_MODE_NORMAL, TEXT_COLOR_BLACK);
GetKey(&input);
if(input == KEY_CHAR_1){
Bdisp_AllClr_VRAM();
i=0;
int line=1,input_l;
//////////////////////////////////////////////////////////////////////////////////////
while(i<ARRAY_SIZE){
PrintXY(1,line,"--[", TEXT_MODE_NORMAL, TEXT_COLOR_BLACK);
print('i',3,line,i+1);
if(i+1>9)PrintXY(6,line,"--]:", TEXT_MODE_NORMAL, TEXT_COLOR_BLACK);
else PrintXY(5,line,"--]:", TEXT_MODE_NORMAL, TEXT_COLOR_BLACK);
PrintXY(9,line,ARRAY_GROUP[i].Char_Value_Whole_2, TEXT_MODE_NORMAL, TEXT_COLOR_BLACK);
if(ARRAY_GROUP[i].Decimal_Digit_Count>0){
PrintXY(9+ARRAY_GROUP[i].Whole_Digit_Count,line,"--.", TEXT_MODE_NORMAL, TEXT_COLOR_BLACK);
PrintXY(10+ARRAY_GROUP[i].Whole_Digit_Count,line,ARRAY_GROUP[i].Char_Value_Decimal_2, TEXT_MODE_NORMAL, TEXT_COLOR_BLACK);
}
if(line==7){
PrintXY(1,8,"--Continue (1)?", TEXT_MODE_NORMAL, TEXT_COLOR_BLACK);
GetKey(&input_l);
if(input_l == KEY_CHAR_1){
line=1;
Bdisp_AllClr_VRAM();
}
else{
i=ARRAY_SIZE;
line++;
}
}
}
event = false;
break;
}else{
Bdisp_AllClr_VRAM();
PrintXY(3,8,"--Failed!", TEXT_MODE_NORMAL, TEXT_COLOR_RED);
}
}
KeyToNum(1);
GetKey(&input);
return;
}
I was pretty sure I had everything down pat, but if I messed up somewhere, I would greatly appreciate assistance. Thanks[/code]