|
In addition to what's already been said, you must read and write a complete sector at the time, else you will get an error.
In order to get the actual sector size, have a look at this sample: http://msdn2.microsoft.com/en-us/library/aa363147.aspx[^]
pdg.BytesPerSector contains the actual sector size.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
write an OOP-based software for a local publisher to generate of the score tally for each football team.
The menu-driven program is to read in the details of teams and also the various match scores from text files or equivalent according the format stated on page 2. Then the program should able to generate the various team scores and display the score tally of the choice of user of either a single individual team or the entire group. The format of the score tally is as follows:
Team Name P W D L F A Pts
which Team Name is the name of team,
P indicates the number of match records entered for the team,
W shows the number of win,
D depicts the number of draw,
L exhibits the number of loss,
F gives the total number of balls entered ‘for’ the team
A views the aggregated number of balls entered ‘against’ the team
and Pts consolidates the point system of each match score of 3 points for a win,
1 for draw and 0 for loss.
For team group display, there is a ranking system among the teams with the team awarded with the highest points (Pts) on top and follows by the rest of the teams in descending order of the points. If there are more than one teams having equal points, then the deciding factor is based on the goal difference which is the difference of ‘for’ (F) and ‘against’ (A).
For the OOP requirement, design the program and implement using two base classes, TEAM and MATCH with the necessary data members and the respective member functions. You may use a derived class, SCORE, basing on the two base classes for the data of the score tally for each team.
You may refer to page 2 and 3 for the sample displays for some details of requirement.
Please exercise creativity and object oriented approach in your program design and make your program as friendly as possible to the users.
The user input format and an example for TEAM details are as follows:
User Input Format Example
No of teams 4
Team 1 Code, Team 1 Name FRA, France
Team 2 Code, Team 2 Name SUI, Switzerland
Team 3 Code, Team 3 Name KOR, South Korea
…. Last Team TOG, Togo
The MATCH details are as follows:
User Input Format Example
No of Matches 6
1st match Score FRA - SUI 0
2nd match Score KOR - TOG 2:1
… FRA - KOR 1:1
TOG - SUI 0:2
TOG - FRA 0:2
SUI - KOR 2
The sample displays are as shown below (user inputs are in bold and underlined):
Sample Display 1: Displaying the Individual Team Score
Main Menu of the Football Score Tally Program
[1] Read in the Team and Match Details
[2] Display Individual Team Score
[3] Display Entire Group Score
[4] Quit the program
Choice? 2
Displaying the 4 teams and the respective 3-letter coding:
France: FRA Switzerland: SUI
South Korea: KOR Togo: TOG
Please enter the 3-letter team code: FRA
Number of the matches played by the France team is 3
Match [1]: France drew with Switzerland 0
Match [2]: France drew with South Korea 1:1
Match [3]: France won Togo 2
The score tally of France team is
P W D L F A Pts
France 3 1 2 0 3 1 5
Sample Display 2: Displaying the Entire Group Score
Main Menu of the Football Score Tally Program
[1] Read in the Team and Match Details
[2] Display Individual Team Score
[3] Display Entire Group Score
[4] Quit the program
Choice? 3
P W D L F A Pts
Switzerland 3 2 1 0 4 0 7
France 3 1 2 0 3 1 5
South Korea 3 1 1 1 3 4 4
Togo 3 0 0 3 1 6 0
***********************************************************************************************
can somebody help me please ?
|
|
|
|
|
1: This is not Rent-A-Coder.
2: Even if it was, I see no cash offering for doing work for you.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
It seems to be your homework. Do you homework and learn programming.
Greetings from Germany
|
|
|
|
|
Simple programmer wrote: You may refer to page 2 and 3...
I don't have this book (must've been absent that day). Can you send it to me?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
It was better you asking about your problem not write a program that...
|
|
|
|
|
for example n=4.
i would get 6 combination out of 4.[1,2][1,3][1,4][2,3][2,4][3,4]
how do i display out those combination?
|
|
|
|
|
Simple programmer wrote: how do i display out those combination?
printf ? std::cout ? CWnd::SetWindowText ? CDC::TextOut ?
or are you thinking about how to compute the combinations ?
|
|
|
|
|
Can you explain your problem properly?
Steve
|
|
|
|
|
i am using the microsoft directX 9.0 for my video capture. Now my problem is i want to detect single face on the webcam (suppose using square size line) and i dont know how to program it in visual C++. Anyone can help me or tell me about related sources~ Thank you very much and God bless...
love-peace-joy
|
|
|
|
|
It will be very difficult to detect a face on the webcam, perhaps it would be better for you to detect movement instead.
|
|
|
|
|
I am working on Dialog based application using MFC in VC++.
In that i have handled Row change message of Grid (GRID_WMUSER_ROWCHANGE) its user defined message and I have written handler :
for example
**CDlg.cpp**
ON_MESSAGE( GRID_WMUSER_ROWCHANGE, fun)
void Cdlg::fun(int n)
{
MessageBox(.....
}
**Cdlg.h**
void fun(int n=0)
now in the Debug build of the Program this works fine. But when i run the application in the Release build the Program crashes as soon as row change of event of Grid occurs.
Now if I correct the above code as
**CDlg.cpp**
ON_MESSAGE( GRID_WMUSER_ROWCHANGE, OnRowChangeGrdLoad)
void Cdlg::fun(int n)
{
MessageBox(.....
}
LRESULT CDlg2701::OnRowChangeGrdLoad( WPARAM wParam, LPARAM lParam )
{
fun();
}
**Cdlg.h file**
afx_msg LRESULT OnRowChangeGrdLoad( WPARAM wParam, LPARAM lParam );
After doing this my application works fine in both Debug and Release build.
I want to know what is the reason behind this?? why such difference in Debug and Release build ??
|
|
|
|
|
|
FWIW, I love the "Ask a friend" link...
The easter egg section also has some interesting content.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
If you are too lazy to even write your own name into account, then I ( and I am sure many others ) will not even bother to read your posts. PLEASE FIX IT!!!
|
|
|
|
|
wrote: I want to know what is the reason behind this?? why such difference in Debug and Release build ??
Stack corruption causes the crash. The correct signature of a message handler, the function takes a WPARAM and an LPARAM (which are pushed onto the stack when the function is called) and returns an LRESULT (which is popped from the stack when the function returns). In the incorrect version of your code, the fun() function is being called as if it had this signature, even though the fun() function does not, and as a result there is stack corruption.
The fact that it works in debug mode is a coincidence, possibly due to padding added by the compiler in debug compilations.
Incidentally, are you still using VC 6.0? The error in signatures for message handlers is flagged as a compiler error in newer versions of Visual Studio.
Mike
|
|
|
|
|
Hi,
I do not really understand the intricacies of MFC messages , especially with Dialog boxes and their controls.
Could you please explain me what does not work with the following example?
I use a Dialog box containing a ListCtrl control.
I derived MYDlgClass class from CDialog.
At first I overloaded OnLButtonDown function because I would like to intercept Mouse events from within the ListCtrl.
I realized that mouse events are captured only when the mouse is outside the controls.
Then I tried to derive a new Class from CListCtrl. Before doing so I removed OnLButtonDown from MYDlgClass.
The first issue is that no ClistCtrl class was available for derivation therefore I derived from CDialog and mofified code within the new class that I Call MyListCtrl.
Finally I overloaded OnLButtonDown but the message is not captured.
Please could you tell me what should I do?
Many thanks for your help.
|
|
|
|
|
Arris7 wrote: I realized that mouse events are captured only when the mouse is outside the controls
You need to see OnNotify handler of parent(dilaog in this case) class.
Arris7 wrote: The first issue is that no ClistCtrl class was available for derivation
What ? Strange !
Which version of VS you are using ?
|
|
|
|
|
What ? Strange !
Which version of VS you are using ?
I use VS2003. Actually When I right click the ListCtrl control and I select Add Class, There are only 3 or classes available ( CDialog, Cpropertypage etc..) but no CListCtrl.
|
|
|
|
|
Use class view to add class, instead.
|
|
|
|
|
That's ok. I've got the solution.
thanks anyway.
|
|
|
|
|
You have derived from CDialog, but the trouble is mouse messages are sent to the controls ( your list control ) not the dialog itself. You need to derive a class from the list control and handle the messages from there.
Another way you could handle this is checking the message paramater of the MSG struct after each call to GetMessage(). Though I'm not exactly sure how you adjust the message loop in MFC.
|
|
|
|
|
You have derived from CDialog, but the trouble is mouse messages are sent to the controls
Actually, the messages are correctly routed to the CDialog. But when the mouse is within the control, I do not know where the messages are routed.
You need to derive a class from the list control and handle the messages from there
I derived a class from CListCtrl but no messages are routed to this class.
Though I'm not exactly sure how you adjust the message loop in MFC.
What is the procedure to do this? What is entry point in VC++ to setup this?
|
|
|
|
|
Hi..
I am having trouble passing a string of a file name (from VB to my c++ DLL)
the function StgOpenStorage requires a "const WCHAR*" for the filename. so what type should i pass to it. I would prefer to pass a VB string and let the DLL do the relevant transulation of types (i don't want to use strPtr(filename) in VB
many thanks
sample code
//-------------------------------------------------------------
SSFILEDLL_API bool __stdcall OpenEmail(fileName)
{
if (bIsopen == false)
{
HRESULT hr;
hr = MAPIInitialize(NULL);
if (FAILED(hr))
return false;
hr = OleInitialize(NULL);
if (FAILED(hr))
return false;
//get storage from msg file
//here is the bit where the filename is used
//hr = StgOpenStorage(L"C:\\Email.msg" works but i want to pass it from vb
hr = StgOpenStorage(filename ,
NULL,
STGM_READWRITE | STGM_TRANSACTED | STGM_SHARE_EXCLUSIVE,
NULL,
0,
&pStorage);
if (FAILED(hr))
return false;
//open a IMessage session
hr = OpenIMsgSession (pMalloc, 0 , &pMsgSession);
if (FAILED(hr))
return false;
//open an IMessage on the IStorage object
hr = OpenIMsgOnIStg(pMsgSession,
MAPIAllocateBuffer,
MAPIAllocateMore,
MAPIFreeBuffer,
pMalloc,
NULL,
pStorage,
NULL,
0,0,&pSourceMsg);
if (FAILED(hr))
{
return false;
}
else
{
bIsopen = true;
return true;
}
}
else
{
return false;
}
}
|
|
|
|
|
read the posting guidelines[^], especially when you post huge code blocks.
Calvin Streeting wrote: Pass a sting
wow, that'll be hard
|
|
|
|