DVD Talk Forum

DVD Talk Forum (https://forum.dvdtalk.com/)
-   Tech Talk (https://forum.dvdtalk.com/tech-talk-10/)
-   -   C++ problem, getting errors during compilation (https://forum.dvdtalk.com/tech-talk/242497-c-problem-getting-errors-during-compilation.html)

mikehunt 10-10-02 12:00 AM

C++ problem, getting errors during compilation
 
this code is real skeletal but it should at least compile shouldn't it?
been a while since I've written any code but I don't think I've forgotten that much
I get errors
D:\...\lottery.cpp(62) : error C2064: term does not evaluate to a function
D:\...\lottery.cpp(65) : error C2064: term does not evaluate to a function
D:\...\lottery.cpp(68) : error C2064: term does not evaluate to a function
D:\...\lottery.cpp(71) : error C2064: term does not evaluate to a function
D:\..\lottery.cpp(74) : error C2064: term does not evaluate to a function
(directory names removed to save some space)

the includes have the greater and less than signs around them but on here they don't get displayed if I include them
Code:

#include "stdafx.h"
#include iostream.h 
#include stdlib.h
#include time.h

void mega();

void take5();

void pick10();

void numbers();

void lotto();

int main(int argc, char* argv[])
{
        int mega[6]; // five numbers 1-52 and a 6th number from 1-52 drawn form a different set
        int take5[5]; // five numbers from 1-39
        int pick10[10]; // ten numbers 1-80
        int numbers[3]; // three numbers, each 0-9
        int lotto[6]; // six numbers 1-59

        int tempmega[6]; // for the individual draws
        int temptake5[5]; // for the individual draws
        int temppick10[10]; // for the individual draws
        int tempnumbers[3]; // for the individual draws
        int templotto[6]; // for the individual draws

        /*for the numbers there will be 3 arrays for counting the number of times a particular number
        is drawn since each digit is from its own set, mega will have 2, one for the first 5 and 1 for the
        6th number as it is from a second set */

        int menuchoice, numdraws;
        int tempdraw; // for each individual number drawn
        int max, tempmax; // for the sort process to find the numbers drawn most
       
        // in these the first number will be the number of times it's occurred and the second will be the number that was drawn
        int sortmega[5][2];
        int sortmegabonus[1][2];
        int sorttake5[5][2];
        int sortpick10[10][2];
        int sortnumbers[1][2];
        int sortnumbers2[1][2];
        int sortnumbers3[1][2];
        int sortlotto[6][2];

        cout<<"Please choose an option:"<<endl;
        cout<<"1) Mega Millions"<<endl;
        cout<<"2) Take 5"<<endl;
        cout<<"3) Pick 10"<<endl;
        cout<<"4) Numbers"<<endl;
        cout<<"5) Lotto"<<endl;
        cin>>menuchoice;

        switch(menuchoice)
        {
                case 1:
                        mega();
                        break;
                case 2:
                        take5();
                        break;
                case 3:
                        pick10();
                        break;
                case 4:
                        numbers();
                        break;
                case 5:
                        lotto();
                        break;
                default:
                        break;
        }

        return 0;
}

void mega()
{

}

void take5()
{

}

void pick10()
{

}

void numbers()
{

}


mikehunt 10-10-02 12:02 AM

compiling in Visual C++ 6 as a win console app
most of my console app programming has been compiled in unix or with borland 4.5 so it might be some weird vis c++ thing I don't know about

jrobinson 10-10-02 12:58 AM


#include "stdafx.h"
#include iostream.h
#include stdlib.h
#include time.h
try this.

#include "stdafx.h"
#include <iostream.h>
#include <stdlib.h>
#include <time.h>

hmm... I don't even think that makes a difference.

What's this stdafx.h? I don't have it in my library... thus'th, I cannot runnith.

DivxGuy 10-10-02 11:12 AM

Give me 10 minutes and I should have a solution.

RD

DivxGuy 10-10-02 11:17 AM

You are getting the error because you have reused the names of your functions inside your local function, and thus you are trying to call an array instead of a function.

Rename the arrays or the functions, and your problems are solved.

RD

mikehunt 10-10-02 06:43 PM

thanks
I always thought they could have the same name since there is a difference between functions and variables, but it's been a while since I did any coding (pretty sad considering I was a CS major)
that stdafx.h header was put in by the vis c++ editor

sfsdfd 10-11-02 10:32 AM


Originally posted by mikehunt
thanks
I always thought they could have the same name since there is a difference between functions and variables,

In some languages, yes, but C++ is so robust that function calls and variable operations might be "performed" by the same sort of code.

- David Stein


All times are GMT -5. The time now is 01:40 AM.


Copyright 2021 MH Sub I, LLC dba Internet Brands. All rights reserved. Use of this site indicates your consent to the Terms of Use.