|
I resolved the error!
It turned up, that VC++ has it' own DirectX.
The solution was to move in Tools->Options-Directories directories containg the DirectX 8 SDK to the most top, so compiler include them first and only then standard VC files
let's try everythin'!
|
|
|
|
|
Hello,
I am having a problem with a function. I am trying to increment a variable (odometer) using the speed and distance traveled.
Below is what I have. Any suggestions are appreciated.
Thanks,
Eric
<br />
void drive( int, int );
<br />
<br />
<br />
<br />
void Car::drive( int spd, int minutes )
{<br />
int remainderMinutes = 0;<br />
int hours;<br />
int distance;<br />
<br />
system( "CLS" );<br />
<br />
while( minutes > 60 )<br />
{<br />
remainderMinutes += minutes % 60 * oneDividedBySixty;<br />
minutes += remainderMinutes;<br />
}<br />
<br />
hours = minutes * oneDividedBySixty;<br />
<br />
distance = spd * minutes;<br />
<br />
cout << "\n\n The distance is " << distance << ".";<br />
cout << "\n\n The speed is " << speed << ".";<br />
cout << "\n\n The time is " << minutes << " minutes.";<br />
}<br />
<br />
<br />
<br />
int main()<br />
{<br />
Car c;<br />
<br />
char choice;<br />
do<br />
{<br />
cout << "\n\n\n Please make a selection from the menu.\n\n";<br />
cout << "\n Press 'D' to display the car attributes.\n";<br />
cout << "\n Press 'R' to reset the car attributes.\n";<br />
cout << "\n Press 'X' to exit the program.\n";<br />
<br />
cin >> choice;<br />
choice = toupper( choice );<br />
<br />
switch( toupper( choice ) )<br />
{<br />
case 'D': c.printCar();<br />
break;<br />
<br />
case 'R': c.reset();<br />
break;<br />
<br />
case 'X': break;<br />
<br />
default: cout << "\n Unknown choice entered.\n"<br />
<< " Enter a new choice.\n\n";<br />
break;<br />
}<br />
<br />
} while ( choice != 'X' );<br />
<br />
<br />
c.reset();<br />
<br />
c.printCar();<br />
<br />
<br />
<br />
c.drive( c.getSpeed(), c.getMinutes() );<br />
<br />
<br />
<br />
cout << "\n\n\n ";<br />
<br />
return 0;<br />
<br />
}<br />
|
|
|
|
|
You should start by describing what your problem is.
SkyWalker
|
|
|
|
|
My problem is that the remainderMinutes equation is not working correctly.
Thank you,
Eric
|
|
|
|
|
How did you declare (and initialize) oneDividedBySixty ?
SkyWalker
-- modified at 8:32 Sunday 23rd October, 2005
|
|
|
|
|
OK, after tracing my code, I have fixed my previous problems (I think).
As of now, my two main concerns are:
1.) Making sure I convert the ints to floats correctly (where needed).
2.) Figuring out what is going on with my destructor (this is all new to me).
Every time I run the program with the destructor, I get an ENTERNAL COMPILER ERROR.
I really appreciate the feedback and suggestions!
Thanks,
Eric
Here is my program:
<br />
<br />
#ifndef HEADER_H<br />
#define HEADER_H<br />
<br />
<br />
class Car<br />
{<br />
public:<br />
Car();<br />
Car( int, string, string, string, string, int );<br />
<br />
void setYear( int );<br />
void setManufacturer( string );<br />
void setModel( string );<br />
void setColor( string );<br />
void setCondition( string );<br />
void setOdometer( int );<br />
<br />
int getYear();<br />
string getManufacturer();<br />
string getModel();<br />
string getColor();<br />
string getCondition();<br />
int getOdometer();<br />
<br />
void printYear();<br />
void printManufacturer();<br />
void printModel();<br />
void printColor();<br />
void printCondition();<br />
void printOdometer();<br />
<br />
int getMinutes();<br />
int getSpeed();<br />
<br />
void drive( int, int );<br />
void newCar();<br />
void displayOdometer();<br />
void reset();<br />
void setCar( int, string, string, string, string, int );<br />
void printCar();<br />
<br />
private:<br />
int year;<br />
string manufacturer;<br />
string model;<br />
string color;<br />
string condition;<br />
int odometer;<br />
int speed;<br />
int minutes;<br />
<br />
};<br />
<br />
#endif<br />
<br />
<br />
<br />
#include <iostream><br />
#include <iomanip><br />
#include <string><br />
<br />
using namespace std;<br />
<br />
#include "Header.h"<br />
<br />
Car::Car()<br />
{<br />
system( "CLS" );<br />
<br />
year = 9999;<br />
manufacturer = "NoManufacturerYet";<br />
model = "NoModelYet";<br />
color = "NoColorYet";<br />
condition = "NoConditionYet";<br />
odometer = 999999999;<br />
}<br />
<br />
Car::Car( int newYear, string newManufacturer, string newModel, string newColor, string newCondition, int newOdometer )<br />
{<br />
system( "CLS" );<br />
<br />
year = newYear;<br />
manufacturer = newManufacturer;<br />
model = newModel;<br />
color = newColor;<br />
condition = newCondition;<br />
odometer = newOdometer;<br />
}<br />
<br />
<br />
<br />
void Car::setYear( int yr )<br />
{<br />
system( "CLS" );<br />
<br />
year = yr;<br />
}<br />
<br />
void Car::setManufacturer( string manufact )<br />
{<br />
system( "CLS" );<br />
<br />
manufacturer = manufact;<br />
}<br />
<br />
void Car::setModel( string mod )<br />
{<br />
system( "CLS" );<br />
<br />
model = mod;<br />
}<br />
<br />
void Car::setColor( string col )<br />
{<br />
system( "CLS" );<br />
<br />
color = col;<br />
}<br />
<br />
void Car::setCondition( string con )<br />
{<br />
system( "CLS" );<br />
<br />
condition = con;<br />
}<br />
<br />
void Car::setOdometer( int odom )<br />
{<br />
system( "CLS" );<br />
<br />
odometer = odom;<br />
}<br />
<br />
int Car::getYear()<br />
{<br />
system( "CLS" );<br />
<br />
return year;<br />
}<br />
<br />
string Car::getManufacturer()<br />
{<br />
system( "CLS" );<br />
<br />
return manufacturer;<br />
}<br />
<br />
string Car::getModel()<br />
{<br />
system( "CLS" );<br />
<br />
return model;<br />
}<br />
<br />
string Car::getColor()<br />
{<br />
system( "CLS" );<br />
<br />
return color;<br />
}<br />
<br />
string Car::getCondition()<br />
{<br />
system( "CLS" );<br />
<br />
return condition;<br />
}<br />
<br />
int Car::getOdometer()<br />
{<br />
system( "CLS" );<br />
<br />
return odometer;<br />
}<br />
<br />
void Car::printYear()<br />
{<br />
<br />
cout <<"\n\n Year: " << year;<br />
}<br />
<br />
void Car::printManufacturer()<br />
{<br />
<br />
cout <<"\n\n Manufacturer: " << manufacturer;<br />
}<br />
<br />
void Car::printModel()<br />
{<br />
<br />
cout <<"\n\n Model: " << model;<br />
}<br />
<br />
void Car::printColor()<br />
{<br />
<br />
cout <<"\n\n Color: " << color;<br />
}<br />
<br />
void Car::printCondition()<br />
{<br />
<br />
cout <<"\n\n Condition: " << condition;<br />
}<br />
<br />
void Car::printOdometer()<br />
{<br />
<br />
cout <<"\n\n Odometer: " << odometer;<br />
}<br />
<br />
int Car::getSpeed()<br />
{<br />
system( "CLS" );<br />
<br />
cout << "\n\n Please enter the speed you drove the car: ";<br />
cin >> speed;<br />
<br />
return speed;<br />
}<br />
<br />
int Car::getMinutes()<br />
{<br />
system( "CLS" );<br />
<br />
cout << "\n\n Please enter the number of minutes you drove the car: ";<br />
cin >> minutes;<br />
<br />
return minutes;<br />
}<br />
<br />
void Car::drive( int spd, int minutes )<br />
{<br />
int miles;<br />
<br />
system( "CLS" );<br />
<br />
miles = ( ( spd * minutes ) / 60 );<br />
odometer += miles;<br />
<br />
cout << "\n\n The speed you entered is " << speed << ".";<br />
cout << "\n\n The number of minutes you entered is " << minutes << " minutes.";<br />
cout << "\n\n The milage added to the odometer is " << miles << ".";<br />
<br />
cout << "\n\n Press Enter to continue.";<br />
cin.get();<br />
}<br />
<br />
void Car::newCar()<br />
{<br />
system( "CLS" );<br />
<br />
cout << "\n Please enter the year of the car: ";<br />
cin >> year;<br />
cout << "\n Please enter the manufacturer of the car: ";<br />
cin >> manufacturer;<br />
cout << "\n Please enter the model of the car: ";<br />
cin >> model;<br />
cout << "\n Please enter the color of the car: ";<br />
cin >> color;<br />
cout << "\n Please enter the condition of the car: ";<br />
cin >> condition;<br />
cout << "\n Please enter the milage (odometer) of the new car: ";<br />
cin >> odometer;<br />
<br />
setCar( year, manufacturer, model, color, condition, odometer );<br />
}<br />
<br />
void Car::displayOdometer()<br />
{<br />
system( "CLS" );<br />
<br />
cout << "\n The odometer is at " << odometer << ".";<br />
}<br />
<br />
void Car::reset()<br />
{<br />
system( "CLS" );<br />
<br />
year = 0;<br />
manufacturer = "";<br />
model = "";<br />
color = "";<br />
condition = "";<br />
odometer = 0;<br />
<br />
cout << "\n\n The car attributes have been reset.\n";<br />
}<br />
<br />
void Car::setCar( int year, string manufacturer, string model, string color, string condition, int odometer )<br />
{<br />
system( "CLS" );<br />
}<br />
<br />
void Car::printCar()<br />
{<br />
<br />
printYear();<br />
printManufacturer();<br />
printModel();<br />
printColor();<br />
printCondition();<br />
printOdometer();<br />
}<br />
<br />
<br />
<br />
#include <iostream><br />
<br />
using namespace std;<br />
<br />
#include "Header.h"<br />
<br />
int main()<br />
{<br />
Car c;<br />
<br />
char choice;<br />
do<br />
{ <br />
cout << "\n\n\n Please make a selection from the menu.\n\n";<br />
cout << "\n Press 'A' to add milage to the odometer.\n";<br />
cout << "\n Press 'C' to clear the screen.\n";<br />
cout << "\n Press 'D' to display the car attributes.\n";<br />
cout << "\n Press 'N' to add new/used car attributes.\n";<br />
cout << "\n Press 'O' to display the odometer.\n";<br />
cout << "\n Press 'R' to reset the car attributes.\n";<br />
cout << "\n Press 'X' to exit the program.\n";<br />
<br />
cin >> choice;<br />
choice = toupper( choice );<br />
<br />
switch( toupper( choice ) )<br />
{<br />
case 'A': c.drive( c.getSpeed(), c.getMinutes() );<br />
break;<br />
<br />
case 'C': system( "CLS");<br />
break;<br />
<br />
case 'D': c.printCar();<br />
break;<br />
<br />
case 'N': c.newCar();<br />
break;<br />
<br />
case 'O': c.displayOdometer();<br />
break;<br />
<br />
case 'R': c.reset();<br />
break;<br />
<br />
case 'X': break;<br />
<br />
default: cout << "\n Unknown choice entered.\n"<br />
<< " Enter a new choice.\n\n";<br />
break;<br />
}<br />
<br />
} while ( choice != 'X' );<br />
<br />
cout << "\n\n\n ";<br />
<br />
return 0;<br />
}<br />
-- modified at 11:04 Sunday 23rd October, 2005
|
|
|
|
|
Does anyone know what the INTERNAL COMPILER ERROR means?
<br />
--------------------Configuration: Implementation - Win32 Debug--------------------<br />
Compiling...<br />
Implementation.cpp<br />
I:\Documents and Settings\Implementation.cpp(48) : fatal error C1001: INTERNAL COMPILER ERROR<br />
(compiler file 'msc1.cpp', line 1794) <br />
Please choose the Technical Support command on the Visual C++ <br />
Help menu, or open the Technical Support help file for more information<br />
Main.cpp<br />
Error executing cl.exe.<br />
<br />
Implementation.exe - 1 error(s), 0 warning(s)<br />
I found this http://owlnext.sourceforge.net/qa51.html[^].
The site says, "This error occurs only on machines with the Windows 95 or Windows 98 operating system."
But I am running Win XP Home w/SP2.
I'm puzzled.
Thanks,
Eric
|
|
|
|
|
Oops, nevermind the INTERNAL COMPILER ERROR.
I forgot a set of parenthesis (see http://lithiumdata.com/QandA/compileerror.htm[^]).
Originally I had:
<br />
Car::~Car<br />
{<br />
cout << "\n\n The destructor has been called.\n\n";<br />
}<br />
Here is what it needs to be:
<br />
Car::~Car()<br />
{<br />
cout << "\n\n The destructor has been called.\n\n";<br />
}<br />
Thanks,
Eric
|
|
|
|
|
if i have a clistctrl on my dialog.
a variable called list is associated with it.
now, i want to add listview-groups in this list.
i try to create a PLVGROUP-structure,
but if i want to run this code, the compiler generates an error.
i can't create any PLVGROUP structure!
what do i have to do to create one? if i create
a variable of PLVGROUP, then i can access it's members, like cbSize.
but if i want to compile, it doesn't work.
can anyone help me?
(i hope you understand my bad english. im from switzerland, so i don't
know english very well )
|
|
|
|
|
|
#include "commctrl.h"
Software Zen: delete this;
|
|
|
|
|
thanks.
but it still doesn't work when i add "#include 'commctrl.h'".
and: how do i specify comctl32.dll, ver. 6 in the manifest?
|
|
|
|
|
LVGROUP is only for XP+ so you have to tell your compiler that you are targeting XP.
in your stdafx.h file add the following
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x501 // target windows NT version 5.01 (XP)
#endif If you do not do this then the portions of commctrl.h that declares LVGROUP etc. is left out by the preprocessor.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
oke, i tried to do this.
but if i compile, it still fails....
do i have to include other headers or
some libs?
i hope you can help me! thanks
|
|
|
|
|
"It fails" is not very discriptive. If look at the compiler output it will give you an error number (ie C####), a brief description of the error, and the line number in your files that caused the error. Look up the error number in MSDN for a better description, and possible solution for the error. Then try to fix your source file taking into account what MSDN says. If you still have troubles, then post the code here that caused the error, and the compiler output that describes the error, complete with the error number. Then maybe I can help you, but the most obvious solutions, based on the very limited info you supplied, has already been given by me and others.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Hi.
Although i have some experience in VC++ but lack in fundamentals and want to learn some basics of VC++ 6.plese help me in this regard.
please forward me the links at "ubiquee@gmail.com".
thanks
|
|
|
|
|
|
Thanks for the link .but i am looking for visual C++ vesion 6.there is a difference between the version 6 and 5.(in commands and prcedures)
|
|
|
|
|
|
Hi.
Although i have some experience in VC++ but lack in fundamentals and want to learn some basics of VC++ 6.plese help me in this regard.
thanks
|
|
|
|
|
|
I have this program I have to write for school that accepts two integers. hours and minutes. I then have to output the format in 6:00 format. I'm only allowed integer division and and modulus division. I've tried everything I can think of but my output still looks like this. 6:0 Any tips?
BINARY
|
|
|
|
|
How about this?
int main(int argc, char* argv[])
{
int hours = 6;
int minutes = 7;
int seconds = 8;
printf("%d:%02d:%02d\n", hours, minutes, seconds);
return 0;
}
|
|
|
|
|
or, without using printf formatting trick, try this:
int main(int argc, char* argv[])
{
int hours = 6;
int minutes = 7;
printf("%d:%d%d\n", hours, minutes / 10, minutes % 10);
return 0;
}
|
|
|
|
|
little too advance for a student who just started learn C++ three weeks ago. Plus It has to advance the hour when the minutes go over 59. I am so stuck.
I cant even use conditional operators
Here's what I got:
#include<iostream><br />
#include<iomanip><br />
using namespace std;<br />
<br />
<br />
int main()<br />
<br />
{<br />
int hours, minutes ;<br />
<br />
<br />
cout << "Input the time as hours and minutes (e.g. 5 23 means 5:23) " ;<br />
<br />
cin >> hours >> minutes ;<br />
<br />
const int minutes_per_hour = 59;<br />
<br />
minutes = minutes + 1;<br />
<br />
<br />
<br />
<br />
cout << " The time is: " << hours<< " :"<< setfill('0')<<setw(1) << minutes << endl ;<br />
<br />
<br />
<br />
<br />
<br />
<br />
system("pause");<br />
<br />
return 0 ;<br />
<br />
}
BINARY
-- modified at 2:22 Sunday 23rd October, 2005
|
|
|
|