Ok, I got it. The real problem was in main 'sales' instead of 'Sales'...
Type: Posts; User: fairguynova
Ok, I got it. The real problem was in main 'sales' instead of 'Sales'...
My thing is the solution code looks the same in terms of the location of the QUARTERS constant.
#ifndef SALES_H_
#define SALES_H_
namespace SALES {
const int QUARTERS = 4;
class Sales {
private:
double sales[QUARTERS];
double average;
RAmen!:)
Ok, I did not fix everything. How can I get the following function to return an address for the longest string int the array of char*:
template <> char* maxn(char* ar[], int n) {
using...
I fixed it, and the code now compiles. Thanks.
Ok, I changed the return type to char*, but now I am getting the following errors:
[Linker error] undefined reference to `int maxn<int>(int*, int)'
[Linker error] undefined reference to `double...
Here is the entire code:
//prototypes
template <class Any>
Any maxn(Any ar[], int n);
template <> Any maxn(char ar[], int n);
int main() {
I am trying to create a specialization for the pointer-to-char type.
Can someone else help spot what is wrong with the following code:
//prototypes
template <class Any>
Any maxn(Any ar[], int n);
template <> Any maxn(char* ar[], int n);
Here are the...
Ok, I think my explaination was wrong, but it works...
Thanks for your help. I realize that when I was passing in a pointer-pointer into a function that expects a pointer.
The line: box * ptr = new box [num_boxes];
I forgot that ptr was already a...
The thing that gets me is that the programs works the first time trough the loop (let us say the number of boxes is 2).
Hi, I am new here first off.
Second, I need help debugging code. This program asks the user for the number of boxes. Then, it creates an array of box structs equal to the number specified by the...