•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 427,168 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,067 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 2379 | Replies: 4
![]() |
•
•
Join Date: Apr 2005
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
I got this assignment to do, but i cant so it, i have tried everything i know in C++ programming and its not working. Can someone help me please.
Write a Graphical User Interface program that simulates the activities of a vending machine. The program should allow for full user input. The requirement for the assignment is as follows:
· Allow the user only to input 5p,10p, 20p,50p, 1.00 notes as legal tender.
· Candy cost 80p , Sugar Rock cost 1.20p , Babydiamond cost 70p.
· The program should be able to calculate the customer’s change given that a discount of 10% is given for more than three items bought.
· The program should be fully validated and generate Pop-up menus, activate on mouse or key events for user input.
· The ability to come up with a creative and original interface design
Write a Graphical User Interface program that simulates the activities of a vending machine. The program should allow for full user input. The requirement for the assignment is as follows:
· Allow the user only to input 5p,10p, 20p,50p, 1.00 notes as legal tender.
· Candy cost 80p , Sugar Rock cost 1.20p , Babydiamond cost 70p.
· The program should be able to calculate the customer’s change given that a discount of 10% is given for more than three items bought.
· The program should be fully validated and generate Pop-up menus, activate on mouse or key events for user input.
· The ability to come up with a creative and original interface design
•
•
Join Date: Apr 2005
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
i am just learning this, i dont even know how to add a textfield.
i have a dialog box though.
<< moderator edit: added [code][/code] tags >>
i have a dialog box though.
include <windows.h>
#include "resource.h"
BOOL CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR cmdParam, INT nShow)
{
DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG), NULL, (DLGPROC)WndProc);
return 0;
}
BOOL CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_INITDIALOG: // This message is send to the window when its been created
break; // You can do any initialization stuff here
case WM_COMMAND: // When something happens in the dialogbox, eg. a button is clicked
switch(wParam)
{
case IDC_BUTTON1: // ID of the control something has happened to. eg. button was clicked
MessageBox(hWnd, "Button 1 Clicked", "", 0);
break;
case IDC_BUTTON2:
MessageBox(hWnd, "Button 2 Clicked", "", 0);
break;
}
break;
case WM_CLOSE: //This message is sent when the application is closing
EndDialog(hWnd, 0); //We call this function to close the dialogbox
break;
}
return false;
}•
•
•
•
Originally Posted by kparnell
i am just learning this, i dont even know how to add a textfield.
Try this site for a tutorial for some "window controls", like "Edit Controls" (textfield)
http://winprog.org/tutorial/controls.html
Hope it's useful, it was for me.
I'll try to be smarter, if you try to be nicer.
![]() |
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- GUI development in LINUX (Window and Desktop Managers)
- GUI using C++ - urgent (C++)
- Project on offer - GUI for ATi Drivers (Software Development Job Offers)
- Help with gui loop. (C)
Other Threads in the C++ Forum
- Previous Thread: Need a little help with password code
- Next Thread: C/C++: Dynamically Scoped Language



Linear Mode