Click here to Skip to main content
15,921,062 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCComboBox problem Pin
Le centriste16-Sep-02 15:27
Le centriste16-Sep-02 15:27 
GeneralRe: CComboBox problem Pin
Shog916-Sep-02 15:30
sitebuilderShog916-Sep-02 15:30 
GeneralRe: CComboBox problem Pin
Le centriste17-Sep-02 3:45
Le centriste17-Sep-02 3:45 
GeneralRe: CComboBox problem Pin
Shog917-Sep-02 4:14
sitebuilderShog917-Sep-02 4:14 
GeneralRe: CComboBox problem Pin
Le centriste17-Sep-02 4:53
Le centriste17-Sep-02 4:53 
GeneralRe: CComboBox problem Pin
Phil J Pearson17-Sep-02 2:22
Phil J Pearson17-Sep-02 2:22 
GeneralRe: CComboBox problem Pin
Le centriste17-Sep-02 3:40
Le centriste17-Sep-02 3:40 
QuestionWeird Errors? Pin
Nick Parker16-Sep-02 13:38
protectorNick Parker16-Sep-02 13:38 
I have a small class that I am working with, however when I try to compile main I get some strange errors. Any clues? Thanks Smile | :)

Errors
<br />
--------------------Configuration: hw3 - Win32 Debug--------------------<br />
Compiling...<br />
hw3.cpp<br />
c:\documents and settings\user\desktop\hw3\hw3.cpp(6) : error C2143: syntax error : missing ';' before 'PCH creation point'<br />
c:\documents and settings\user\desktop\hw3\hw3.cpp(6) : error C2239: unexpected token '{' following declaration of 'days_array'<br />
c:\documents and settings\user\desktop\hw3\hw3.cpp(6) : error C2513: 'int' : no variable declared before '='<br />
c:\documents and settings\user\desktop\hw3\hw3.cpp(7) : fatal error C1903: unable to recover from previous error(s); stopping compilation<br />
Error executing cl.exe.<br />
<br />
hw3.obj - 4 error(s), 0 warning(s)<br />




hw3.cpp
#include "hw3.h"


int days_array{} =
{

31, 28, 31, 30, 31, 30,

31, 31, 30, 31, 30, 31

};


int main()
{
	Date today

	today.set(03, 01, 1994);

	for (int I = 0; I < 370; ++I)
	{
		today.increment();
		today.display();
	}
	return 0;
}


hw3f.cpp
#include <iostream.h>
#include "hw3.h"

void Date::setdate(int month, int day, int year)
{
	Date::month = month;
	Date::day = day;
	Date::year = year;
}

void Date::increment()
{

	int i = day++;
	if(i > days_array[month])	
	{
		//overflow, increase month by 1 and set day to 1
		if(month == 12)
		{
			month = 1;
			day = 1;
			year++;
		}
		else
		{
			month++;
			day = 1;
		}	
	}
	else
	{
		day = i;
	}

}

void Date::display()
{
	cout << month << "/" << day << "/" << year << endl;
}


hw3.h
#ifndef hw3_h
#define hw3_h


class Date
{

private:
	int month;
	int day;
	int year;
public:
	void setdate(int, int, int);
	void increment();
	void display();
	
}

#endif


Nick Parker

“Nothing is less productive than to make more efficient what should not be done at all.”
-Peter Drucker



AnswerRe: Weird Errors? Pin
PJ Arends16-Sep-02 13:56
professionalPJ Arends16-Sep-02 13:56 
GeneralRe: Weird Errors? Pin
Nick Parker16-Sep-02 13:56
protectorNick Parker16-Sep-02 13:56 
GeneralRe: Weird Errors? Pin
Neville Franks16-Sep-02 15:58
Neville Franks16-Sep-02 15:58 
AnswerRe: Weird Errors? Pin
Raphael Kindt17-Sep-02 0:52
Raphael Kindt17-Sep-02 0:52 
GeneralSocket programming Pin
xai16-Sep-02 12:44
xai16-Sep-02 12:44 
GeneralRe: Socket programming Pin
xai16-Sep-02 13:02
xai16-Sep-02 13:02 
GeneralRe: Socket programming Pin
PJ Arends16-Sep-02 13:36
professionalPJ Arends16-Sep-02 13:36 
GeneralRe: Socket programming Pin
xai16-Sep-02 13:54
xai16-Sep-02 13:54 
GeneralRe: Socket programming Pin
PJ Arends16-Sep-02 14:15
professionalPJ Arends16-Sep-02 14:15 
GeneralRe: Socket programming Pin
xai16-Sep-02 14:23
xai16-Sep-02 14:23 
QuestionHow to give arguments to Win32 application Pin
rsasalm_16-Sep-02 10:31
rsasalm_16-Sep-02 10:31 
AnswerRe: How to give arguments to Win32 application Pin
Michael Dunn16-Sep-02 11:18
sitebuilderMichael Dunn16-Sep-02 11:18 
AnswerRe: How to give arguments to Win32 application Pin
PJ Arends16-Sep-02 12:45
professionalPJ Arends16-Sep-02 12:45 
GeneralRe: How to give arguments to Win32 application Pin
rsasalm_16-Sep-02 23:48
rsasalm_16-Sep-02 23:48 
Generaltrying to find old post about EN_CHANGE Pin
ns16-Sep-02 8:59
ns16-Sep-02 8:59 
GeneralRe: trying to find old post about EN_CHANGE Pin
jmkhael16-Sep-02 9:01
jmkhael16-Sep-02 9:01 
GeneralRe: trying to find old post about EN_CHANGE Pin
ns16-Sep-02 9:05
ns16-Sep-02 9:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.