|
I need help with a few more programs please help me.
Thank you Neville Franks and DougwW48 for help earlier, I appreciate it. Please help me one more time.
I tried these and they start like this one:
#include "conio.h"
#include "stdio.h"
void main ()
{
getch();
}
The questions are:
compile a program that will ask the user for an amount in cents ($1.23 = 123 cents). It should then display the number of quarters, dimes, nickels, and pennies equal to the amount.
compile a program that will ask the user for their age. If the age entered is greater than or equal to 18, the program should display that the user is old enough to vote. Otherwise, the program should tell how many years until the user can vote.
compile a program that will ask the user for two floating point numbers. The second number asked for should be the percentage the user wants to find of the first number. It should then display the result of finding the percentage in this format:
Example:
Enter a number: 25
What percent of 25 would you like to find? 3
3% of 25 is 0.75
Thanks a lot for the help.
I get so close on these but can't seem to get them working, i always get 1 or 2 errors. Thanks
|
|
|
|
|
i think you should post you program...what you have done till now... and ask ppl to rectify your errors rather than asking the questions and make ppl do your homework for you...
it will do you good..
With Regards
Joseph R. Thomas
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
|
|
|
|
|
so close to what?
finishing your homework??
With Regards
Joseph R. Thomas
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
|
|
|
|
|
looking at your question..it seems that these are the first or secong questions of the C++ language learning that you might be doin...if you ask others to do it for you...you wont be able to learn the language at all...
so i suggest u take up a book and start some serious learning...
With Regards
Joseph R. Thomas
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
|
|
|
|
|
Colin;
I agree with the other guys that you really need to learn this stuff on your own if you ever hope to understand it! And don't freak out about projects, it'll only make them seem more difficult. I'll help you out on the money question this time. From the code that Neville and myself have sent you so far, you should be able just to change a few lines and complete your other questions.
colin21 wrote:
compile a program that will ask the user for an amount in cents ($1.23 = 123 cents). It should then display the number of quarters, dimes, nickels, and pennies equal to the amount.
#include <iostream>
using namespace std;
int main()
{
int Total, Quarters, Dimes, Nickels, Pennies;
cout << "Enter the total amount of cents: ";
cin >> Total;
Pennies = Total;
Quarters = Pennies / 25;
Pennies = Pennies % 25;
Dimes = Pennies / 10;
Pennies = Pennies % 10;
Nickels = Pennies / 5;
Pennies = Pennies % 5;
cout << "$" << Total/100 << "." << Total%100 << " is equal to:\n";
cout << Quarters << " quarters\n";
cout << Dimes << " dimes\n";
cout << Nickels << " nickels\n";
cout << Pennies << " pennies\n";
return 1;
}
If you have questions on your other two projects, it would probably be a good idea to post your code so people can help you fix what you have wrong instead of guessing and giving you the answers. I hope I got an A!
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
the code(s) that you gave me don't work at all. mine use printf and scanf and they use parentheses not << >>. thanks for helping though, i am seeming to get it better now. i will take your advice and post what i have so far and then ask. maybe you can help me better then.
[Colin]
|
|
|
|
|
Sorry about the cin and cout statements, I assumed you were taking c++ and not c. It shouldn't be hard to change them into scanf and printf statements. Good luck!
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
I use icons from system dlls in my app
TreeView draws thick black edge instead of
transparent shadow. What is the best way to solve this problem?
Thanks in advance.
|
|
|
|
|
Hi,
Don't ask me why, but I wanna create a button the hard way. I don't want to use the CButton class.
So basically I want to call the CreateWindow function with a class I registered my self. I already discovered I can use the predefined control-class WC_BUTTON with the following call to get a button on my window:
CreateWindow(WC_BUTTON,"caption",<styles>,0,0,200,200,hWnd,NULL,hInstance,NULL);
only problem is, I can't link an eventhandler to the button, right? Or maybe I just don't know how..
Anyways, the other way I thought of was registering my own class (using RegisterClass and the WNDCLASS struct) and specifying my own WndProc to handle events. But how do I configure the class as a button, in other words how do I make it look like a button, which is pushable? Or will it actually be that hard that I need to define my own graphics, on MBUTTONDOWN the sunken box is painted, etc.
I'm just interested in the way this stuff works... if somebody knows something, please let me know too
Many thanks in advance,
DanglingDude.
|
|
|
|
|
If i right understand your question
it can be done creating button using
CreateWindow(WC_BUTTON ...) and then setting its WndProc
to your own defined using
<br />
LONG DefWndProc=SetWindowLong(hWndButton,GWL_WNDPROC,lpfnYourOwnWndProc);<br />
you should also call default button process using pointer returned by SetWindowLong() at return of your own WndProc.
|
|
|
|
|
Aaaah, this is exactly what I needed.
Thanks alot!
|
|
|
|
|
An alternative to providing a new wndproc for the button, the button control sends a BN_CLICKED message through a WM_COMMAND to the parent window when the button is click. You'll be able to listen out for that. I find that easier (depending on the circumstances) than providing a new wndproc for the button.
Phil
|
|
|
|
|
Hi
I just upgraded from Visual C++ 6 to .NET, and I can't find an option to set the paths for includes and libs, where is it gone? I need to include the boost regex directory into my project.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
It's hidden a little bit.
Go to the Tools/Options.
Here in a tree on the left go to Projects and you'll see VC++ Directories.
You're in then!
hope this helps
|
|
|
|
|
Ah, this was really a tricky one.
Thanks a lot!
modified 12-Sep-18 21:01pm.
|
|
|
|
|
hello iv been trying all day to register the login details for my irc client that i coded with winsock in vc++,here's the code im executing it all compiles nicley but it just wont register with irc, please help
CString m_User;
CString m_Nick;
CString m_Channel;
CString m_Pass;
m_Pass = " secretpass ";
m_Nick = " chris";
m_User = " chris na www.baka-baka.com:chris shread";
m_Channel = " projectx ";
CString PassCommand = "PASS" + m_Pass + "\r\n";
CString NickCommand = "NICK" + m_Nick + "\r\n";
CString UserCommand = "USER" + m_User + "\r\n";
CString JoinCommand = "JOIN" + m_Channel + "\r\n";
send(Socket,PassCommand,strlen(PassCommand),0);
send(Socket,NickCommand,strlen(NickCommand),0);
send(Socket,UserCommand,strlen(UserCommand),0);
send(Socket,JoinCommand,strlen(JoinCommand),0);
it replys saying i have to register b4 i can join??
well iv tried registering as u can c but no joy
thank you all!
|
|
|
|
|
Could someone tell me how to do a memory dump in XP. Tried the old DOS method, but it's not supported.
Thanks, Paul
|
|
|
|
|
|
I need some new eyes on this one, it's driving me mad
I am trying to use Bob Mottram's classes.
Everything compiles from the download
http://prdownloads.sourceforge.net/rodney/facedetect.zip?download[^]
But when I imported the files into my project I receive
Fatal Error C1010
unexpected end of file while looking for precompiled header directive
classimage.cpp<br />
C:\Backup2\carl2\classimage.cpp(573) : fatal error C1010: unexpected end of file while looking for precompiled header directive<br />
I have OpenCV hooked up correctly and imported all the files neccesary, I believe any ideas? Thanks
Later, JoeSox www.joeswammi.com www.humanaiproject.org
|
|
|
|
|
|
Michael Dunn wrote:
See the FAQ
Thanks Michael! That worked, of course. You helped stop me from chasing my tail! I miss the easy details sometimes.
But It gave me these 2 warnings
classimage.cpp<br />
Generating Code...<br />
Linking...<br />
Creating library Release/carl2.lib and object Release/carl2.exp<br />
carl2.exp : warning LNK4070: /OUT:facedetect.exe directive in .EXP differs from output filename "Release/carl2.exe"; ignoring directive<br />
Release/carl2.exe : warning LNK4086: entrypoint "_WinMainCRTStartup" is not __stdcall with 12 bytes of arguments; image may not run
What does this mean to you? I think I know what the first means but the second?
Later, JoeSox www.joeswammi.com www.humanaiproject.org
|
|
|
|
|
Well, I took out a .def file that was originally made for the exporting of the functions since it was originally a .dll,
; facedetect.def : Declares the module parameters for the DLL.<br />
<br />
LIBRARY "facedetect"<br />
DESCRIPTION 'facedetect Windows Dynamic Link Library'<br />
<br />
EXPORTS<br />
RCobj_InitFaceDetect<br />
RCobj_detectfaces<br />
RCobj_getObject<br />
RCobj_setBorder<br />
RCobj_detectfeatures<br />
RCobj_trackface
that got rid of the warnings but now the main app's dialogbox doesn't appear upon execution, hhmmm.
Later, JoeSox www.joeswammi.com www.humanaiproject.org
|
|
|
|
|
|
please include"stdafx.h" in source file and header file,
or turn using precompilerd header off in program setting.
if you turn on using precompiled header, vc will compile the source code
beginning at stdafx.h
hope this helps to you.
dupengfei
|
|
|
|
|
Hi All,
Is there any way we can check if a certain directory has been modified????
thanks
Dilshad
|
|
|
|