Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Lab3_1

Name: Anonymous 2008-07-12 1:02

Hello programming.

I need some help with a school lab that's due tomorrow.

http://rafb.net/p/VQP2jS77.html <--- lab3_1.cpp
http://rafb.net/p/kUUrMi81.html <--- lab3_1.h

Compile errors:
error C3861: 'Divide': identifier not found, even with argument-dependent lookup
error C2365: 'Divide' : redefinition; previous definition was a 'formerly unknown identifier'
error C2365: 'Mutiplication' : redefinition; previous definition was a 'formerly unknown identifier'
error C2365: 'Subtract' : redefinition; previous definition was a 'formerly unknown identifier'
error C2440: '=' : cannot convert from 'int' to 'testLevel'
error C2440: '=' : cannot convert from 'int' to 'testLevel'
error C2440: '=' : cannot convert from 'int' to 'testLevel'
error C3861: 'Mutiplication': identifier not found, even with argument-dependent lookup
error C3861: 'Subtract': identifier not found, even with argument-dependent lookup

Name: Anonymous 2008-07-12 1:40

>>2
You're needlessly forcing a conversion from integers and your enum. You should just define
enum testLevel { EASY = 10, MEDIUM = 20, HARD = 30 };
in your header file. Then change lines 71-81 in the .c file to:
switch (l){
   case 1:
      level = EASY;
      return EASY;
   case 2:
      level = MEDIUM;
      return MEDIUM;
   case 3:
      level = HARD;
      return HARD;
}

But you'd still have to figure out why you're setting level in two places (inside the getTestLevel() function and then immediately after when you call setTestInfo(testType, testLevel). In short, read SICP.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List