1> graphcalc.cpp
1>c:\users\jill\documents\visual studio 2010\projects\graphic calculator\graphcalc.cpp(22): error C2327: 'function::degree' : is not a type name, static, or enumerator
1>c:\users\jill\documents\visual studio 2010\projects\graphic calculator\graphcalc.cpp(22): error C2065: 'degree' : undeclared identifier
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Fair enough, changed int degree; to int degree = 1;
It doesn't compile either.
1 2 3 4 5
1> graphcalc.cpp
1>c:\users\jill\documents\visual studio 2010\projects\graphic calculator\graphcalc.cpp(21): error C2864: 'function::degree' : only static const integral data members can be initialized within a class
1>c:\users\jill\documents\visual studio 2010\projects\graphic calculator\graphcalc.cpp(22): error C2327: 'function::degree' : is not a type name, static, or enumerator
1>c:\users\jill\documents\visual studio 2010\projects\graphic calculator\graphcalc.cpp(22): error C2065: 'degree' : undeclared identifier
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
The length of a C-Style array must be a compile time constant so that the array can be allocated at compile time. function::degree needs to be constant in order for it to be used as function::coeff's array length.
Array lengths must be determined when you compile the code. Arrays can not be created while the program is running. Also, the [size] of an array must be a constant integer, because arrays can not be created by variables with no number.
Well... I would like to use an array for storing the coefficients of an expression. The user would be able to select an nth degree equation, and then enter n coefficients for the expression. If the user needed a linear function, n would be one; a quadratic would be two, cubic would be three; etc.
I want to use an array so I can call coeff [0], coeff [1] ... coeff [n-1] individually, instead of having to create float coeffa; float coeffb... float coeff n; and create a very messy code. Is there no way to get around it?