Forum: C++ Nov 14th, 2008 |
| Replies: 17 Views: 1,120 If you need to perform the two bold statements, then the best way would be something like this:
1. Prompt user for his name and package choice.
2. Prompt user for the number of hours.
3. Compute... |
Forum: C++ Nov 11th, 2008 |
| Replies: 3 Views: 373 I thought there are already such product in the market? Go google "secure usb flash drive". |
Forum: C++ Nov 11th, 2008 |
| Replies: 5 Views: 496 We don't do homework for people here. Try it out yourself and post up your code if you encounter any problems. |
Forum: C++ Nov 11th, 2008 |
| Replies: 4 Views: 699 1. Not all paths in your function returns an integer. You would encounter a warning if you try to compile your code.
2. What's the use of "n" and "m" ?
3. Seed your random generator once in... |
Forum: C++ Nov 9th, 2008 |
| Replies: 17 Views: 1,120 Well, initialized the variable "cost" then. In fact, make it a habit to initialize all your variables. |
Forum: C++ Nov 9th, 2008 |
| Replies: 4 Views: 579 Before learning how to use those child controls like buttons, edit boxes, etc, you need to learn how to create a windows application.
You can try to go through the following tutorial:
Win32 API... |
Forum: C++ Oct 24th, 2008 |
| Replies: 3 Views: 428 Check this out for big number library: Bignum library (http://gmplib.org/) |
Forum: C++ Oct 23rd, 2008 |
| Replies: 7 Views: 1,400 Line 19: Replace << with semicolon ;
Line 22: "If" should not be capitalized too |
Forum: C++ Oct 22nd, 2008 |
| Replies: 5 Views: 2,338 I suppose you are using Visual C++. From the little info that you give, you seem to be calling the function AfxMessageBox, but passing parameter that does not match its declaration.
We need to see... |
Forum: C++ Oct 22nd, 2008 |
| Replies: 4 Views: 438 Take away all those semi-colons after the if and else-if statement:
if (score >= 85);
grade = 'A';
else if (score >= 75);
grade = 'B';
else if (score >= 65);
... |
Forum: C++ Oct 22nd, 2008 |
| Replies: 2 Views: 1,416 These two files are the compiler and linker. You probably have to restart your visual studio, or even reboot your pc, and try it again.
You can try to create a simple hello world application and... |
Forum: C++ Oct 22nd, 2008 |
| Replies: 2 Views: 850 Where did you assign the value for variable num? |
Forum: C++ Oct 22nd, 2008 |
| Replies: 1 Views: 337 You don't need an extra function. Just add one more case option inside the function do_next_op. |
Forum: C++ Oct 21st, 2008 |
| Replies: 1 Views: 208 Do you know the difference between declaring a function and calling a function?
To declare a function, you do this:
void instruction();
void divide_by_zero (char, float);
float do_next_op... |
Forum: C++ Oct 21st, 2008 |
| Replies: 8 Views: 512 If there's no further issue, please mark the thread as solved. :) |
Forum: C++ Oct 21st, 2008 |
| Replies: 2 Views: 573 You should choose Win32 Dynamic Linked Library instead of MFC AppWizard (DLL).
After choosing that, select "A simple DLL project". Overwrite the original DllMain function that VC++ provides with... |
Forum: C++ Oct 21st, 2008 |
| Replies: 3 Views: 366 There are some more problems with your codes:
1. You never initialized the variable "removed", yet you used it to keep track of the turns:
removed += turn; //Keep a running total of turns
... |
Forum: C++ Oct 21st, 2008 |
| Replies: 3 Views: 366 There are a number of ways to get out of the loop. One way is to put the break statement when someone wins the game:
if (left < 1)
{
cout << " Player 1, You have one the game!" << endl;
break;... |
Forum: C++ Oct 21st, 2008 |
| Replies: 11 Views: 774 I just realize from the other similar thread that this is the last question on your assignment. So before this question, you would have to implement the power function and squareroot function. Why... |
Forum: C++ Oct 20th, 2008 |
| Replies: 11 Views: 774 You should use the function sqrt() to find the square root of a variable.
For example:
c = sqrt(x);
You will need to include the header file <math.h> to use this function though. |
Forum: C++ Oct 20th, 2008 |
| Replies: 1 Views: 294 Take away this line:
return displayGrade;
As for the loop, it will keep on prompting you for the next score, until you enter -1 then it will come out of the loop. |
Forum: C++ Oct 20th, 2008 |
| Replies: 11 Views: 774 The parentheses are wrong. Look closely:
c=(((a/c)+c)/2)+((b/c)+c)/2)));
Also, are you sure that's the correct formula for calculating the hypotenuse? Why is variable "c" used in the... |
Forum: C++ Oct 20th, 2008 |
| Replies: 11 Views: 774 Try writing out the function and post it here. The driver file is supposed to call the function, pass parameters to it, and gets return value (if any) back. It is used for the purpose of testing... |
Forum: C++ Oct 20th, 2008 |
| Replies: 2 Views: 343 Anything divide by zero will become infinity. So you need to cater for the case whereby the operator is "/" and the operand num is 0. If such case is met, instead of performing the computation, maybe... |
Forum: C++ Oct 20th, 2008 |
| Replies: 11 Views: 774 Have you tried to compile?
Your header file needs the statement "#endif" at the end. The inclusion detection system works in this way:
#ifndef FUNCTION_H
#define FUNCTION_H
// Put all your... |
Forum: C++ Oct 20th, 2008 |
| Replies: 8 Views: 512 Look at your line 60 and line 66. This is not the way you decrement the value.
You should do this:
STAMINA = STAMINA - 2;
or this:
STAMINA -= 2; |
Forum: C++ Oct 20th, 2008 |
| Replies: 5 Views: 892 I just browse through the site that Aia provides. It DID tell you the things that you need to know right now, that is, to understand how a windows application works.
You need to understand that a... |
Forum: C++ Oct 20th, 2008 |
| Replies: 5 Views: 892 if-statements still works the same way as console-based application.
What you need to know is how a windows application works, not how if-statement works. Windows application basically has a loop... |
Forum: C++ Oct 20th, 2008 |
| Replies: 6 Views: 570 This is where the problem is:
for(int i=0; i<MAX; i--)
cout<<Input_String<<endl;
You initialize variable "i" to zero, decrement it in every step, until it is smaller than MAX (which is... |
Forum: C++ Oct 20th, 2008 |
| Replies: 1 Views: 372 I saw a very similar post with a very similar question here just now. Classmates? :P
Anyway, the rules here is that you need to try out yourself, show us what you have done, what problems you... |
Forum: C++ Oct 20th, 2008 |
| Replies: 3 Views: 387 I can't get access to a compiler atm but I will tell you no it don't work. |
Forum: C++ Oct 20th, 2008 |
| Replies: 1 Views: 440 I did not go through the entire post, but I notice your myfunction.h has something wrong. The first few lines of declaration did not state the return type and the required parameters. Also, the... |
Forum: C++ Oct 19th, 2008 |
| Replies: 6 Views: 502 Just notice another problem. Instead of using :
else if ( 15000 < income <= 44000)
you should write it as something like:
else if ( (15000 < income) && (income <=... |
Forum: C++ Oct 19th, 2008 |
| Replies: 6 Views: 502 Just add a decimal point behind each 100. |
Forum: C++ Oct 17th, 2008 |
| Replies: 25 Views: 1,895 That's very ambitious. How long do you think you would take to finish this 6000-page book? |
Forum: C++ Oct 17th, 2008 |
| Replies: 7 Views: 514 1. Please use "int main()". You are returning 0 at the end of main(), yet you declare that main() return void.
2. You lack a closing brace "}" and a return statement for do_next_op(). |
Forum: C++ Oct 17th, 2008 |
| Replies: 8 Views: 748 What's the purpose of this thread??? To show an inferior implementation of stack? |
Forum: C++ Oct 17th, 2008 |
| Replies: 4 Views: 445 Where's your switch statement? You should do something like this:
switch(choice)
{
case 'A':
if(hours > A_ALLOWED_HOURS)
{
// Compute charges
} |
Forum: C++ Oct 17th, 2008 |
| Replies: 18 Views: 1,638 Alright, I will comment base on your latest codes, cos I don't really have time to go through all the posts. Also, I will skip removeAt() function at this moment and focus on the rest.
1. At the... |
Forum: C++ Oct 16th, 2008 |
| Replies: 18 Views: 1,638 Are you sure your program runs fine? At the first glance, there's so many errors in it:
1. Your main function is passing uninitialized variables' values like index and insertItem into removeAt()... |