Go Back  DVD Talk Forum > General Discussions > Tech Talk
Reload this Page >

C++ problem, getting errors during compilation

Tech Talk Discuss PC Hardware, Software, Internet and Other Technology

C++ problem, getting errors during compilation

Old 10-09-02, 11:00 PM
  #1  
DVD Talk Hero
Thread Starter
 
Join Date: Aug 2000
Location: Bartertown due to it having a better economy than where I really live.
Posts: 29,765
Received 9 Likes on 4 Posts
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>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()
{

}

Last edited by mikehunt; 10-09-02 at 11:04 PM.
Old 10-09-02, 11:02 PM
  #2  
DVD Talk Hero
Thread Starter
 
Join Date: Aug 2000
Location: Bartertown due to it having a better economy than where I really live.
Posts: 29,765
Received 9 Likes on 4 Posts
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
Old 10-09-02, 11:58 PM
  #3  
Video Gamer Reviewers
 
Join Date: May 2000
Posts: 4,161
Likes: 0
Received 0 Likes on 0 Posts
#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.
Old 10-10-02, 10:12 AM
  #4  
DVD Talk Platinum Edition
 
Join Date: Oct 1999
Location: South Surrey, BC
Posts: 3,990
Likes: 0
Received 0 Likes on 0 Posts
Give me 10 minutes and I should have a solution.

RD
Old 10-10-02, 10:17 AM
  #5  
DVD Talk Platinum Edition
 
Join Date: Oct 1999
Location: South Surrey, BC
Posts: 3,990
Likes: 0
Received 0 Likes on 0 Posts
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
Old 10-10-02, 05:43 PM
  #6  
DVD Talk Hero
Thread Starter
 
Join Date: Aug 2000
Location: Bartertown due to it having a better economy than where I really live.
Posts: 29,765
Received 9 Likes on 4 Posts
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

Last edited by mikehunt; 10-10-02 at 05:46 PM.
Old 10-11-02, 09:32 AM
  #7  
DVD Talk Legend
 
Join Date: Oct 1999
Location: |-|@><0r [email protected]|)
Posts: 17,214
Likes: 0
Received 0 Likes on 0 Posts
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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Thread Tools
Search this Thread

Archive - Advertising - Cookie Policy - Privacy Statement - Terms of Service - Do Not Sell My Personal Information -

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