Forum: C++ Sep 21st, 2008 |
| Replies: 9 Views: 662 Yeah.. You can do that... You just declare the List and the class (for eg. Class car) as usual. The only thing special is that the ListItemType is car.
class Car
{
private:
string name;... |
Forum: C++ Sep 21st, 2008 |
| Replies: 8 Views: 945 To do that, you can declare another 2 variable name total_ticket_sold and total_revenue. Then assign them with value 0. In the while loop, add another 2 lines of code:
total_ticket +=... |
Forum: C++ Sep 18th, 2008 |
| Replies: 1 Views: 310 At least put in some effort and try write something before posting your problem??:-/ |
Forum: C++ Sep 16th, 2008 |
| Replies: 21 Views: 2,666 The sorting method you are using now is Bubble Sort. You can use another popular sorting methods like Insertion Sort, Selection Sort, Merge Sort and Quick Sort. Actually these sorting are a lot more... |
Forum: C++ Sep 10th, 2008 |
| Replies: 4 Views: 529 Or may be convert the double into string. Then split the string using "." as the delimiter?? |
Forum: C++ Sep 9th, 2008 |
| Replies: 13 Views: 1,210 Err.... Pads, Give you some hint on the menu.
Just use cout and a few switch(). Give it a try first. The best way to learn is to try it your self. ;)
***Hi, jason102178. If you want to post a... |
Forum: C++ Sep 9th, 2008 |
| Replies: 7 Views: 559 Hi, I edited some of your code. Here it is. The reason it won't come out from while loop is because isspace() included the newline ("\n") as a kind of "space". See this... |
Forum: C++ Sep 8th, 2008 |
| Replies: 13 Views: 1,210 void calculation(double height[5], double weight[5], double BMI[5])
{
//Do some calculations on the height, weight and BMI to get what you want....
} |
Forum: C++ Sep 8th, 2008 |
| Replies: 13 Views: 1,210 Put in some effort and try at least do write a simple program??? :) |
Forum: C++ Sep 7th, 2008 |
| Replies: 1 Views: 338 Use switch() may be? Do you need the number to be shuffled?? Put in some effort. Try writing at least a simple program and post it. :) |
Forum: C++ Sep 4th, 2008 |
| Replies: 11 Views: 2,113 Here's another tutorial on switch()
----> http://www.codeguru.com/cpp/cpp/cpp_mfc/article.php/c4067
Try to write a program first. Then you can post your questions here. :) |
Forum: C++ Sep 4th, 2008 |
| Replies: 6 Views: 686 :P C++ isn't as tough as you thought. Just have more practice and stick with this forum. I learned a lot from this forum. Happy coding!! |
Forum: C++ Sep 4th, 2008 |
| Replies: 13 Views: 1,107 Good... Even signature is checked! :twisted: |
Forum: C++ Sep 4th, 2008 |
| Replies: 19 Views: 3,436 If you want to randomly generate number between certain range you can use :
rand()% x, where x is the maximum number.
Exp: rand()% 50, means range is 1-50.
Is this what you want?? |
Forum: C++ Sep 4th, 2008 |
| Replies: 6 Views: 686 You definitely have to work on your alignment of your coding. The alignment and programming style should be consistent. The reason why you program is not working when you choose option 2 is because... |
Forum: C++ Sep 3rd, 2008 |
| Replies: 11 Views: 2,113 jhonnyboy, it will be better if you can try to write a program first then post your coding.
mahlerfive is right but another alternative way is to store the number the user input in string then you... |
Forum: C++ Sep 3rd, 2008 |
| Replies: 4 Views: 726 RenjitVR, if I do that, means I can only input maximum 20 string item right? What I'm trying to get is unlimited input. Something like a simple dynamic array.
** Thanks Jencas and Salem for your... |
Forum: C++ Sep 2nd, 2008 |
| Replies: 2 Views: 471 Use string or character array as data type.
Then use cin.getline() to get input from user.
while (choice == 'y');
It would be better to change this line to:
while (tolower(choice) !=... |
Forum: C++ Sep 2nd, 2008 |
| Replies: 6 Views: 825 Obj7777 is right... At least put in some effort to try first... |
Forum: C++ Sep 2nd, 2008 |
| Replies: 6 Views: 825 The first line is in Malay. It means that: |
Forum: C++ Sep 2nd, 2008 |
| Replies: 4 Views: 726 I have this problem. This program runs well except that it skip the value of the first item in list. I think it is because of the cin.ignore(). But if I don't use the cin.ignore(). The cin will only... |
Forum: C++ Sep 2nd, 2008 |
| Replies: 4 Views: 581 Well.... If you want to use the getline function, here's a simple program to test that:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{ |
Forum: C++ Aug 24th, 2008 |
| Replies: 8 Views: 747 There is no need to be mean niek_e. Just trying to help. Anyway, I did learn something new. Thanks. :sad: |
Forum: C++ Aug 22nd, 2008 |
| Replies: 8 Views: 747 Yeah. Other than cin.get(), you can use getchar() or system("pause"). Other than clear_screen you can use system("CLS"). |
Forum: C++ Aug 22nd, 2008 |
| Replies: 8 Views: 610 Just to make it clearer....
1. Add another statement at the end of your coding. Prompt User to enter a certain character to exit from the program.
2. iamthwee is right. Use a do-while loop to... |
Forum: C++ Aug 21st, 2008 |
| Replies: 6 Views: 598 It'll be better for you to post your coding and tell us what's your problem... : ) |
Forum: C++ Aug 19th, 2008 |
| Replies: 18 Views: 2,396 #include <stdlib.h>
#include <iostream>
using namespace std;
int main()
{
const int MAX_SIZE = 10;
int numbers[MAX_SIZE];
int numElements; |
Forum: C++ Jun 27th, 2008 |
| Replies: 6 Views: 707 Well, I would suggest you to move the app.exe to the same folder in which you save your .cpp files. Then you can just use type:
system ("app.exe -vb \C:\\Documents and... |
Forum: C++ Jun 19th, 2008 |
| Replies: 21 Views: 2,694 Thanks Ancient Dragon! It works now! |
Forum: C++ Jun 19th, 2008 |
| Replies: 3 Views: 759 Well, I suppose this would solve your problem. You can merge the sort() into the insert().
Here's the code:
#include <iostream>
#include <fstream>
using namespace std;
class List
{ |
Forum: C++ Jun 19th, 2008 |
| Replies: 21 Views: 2,694 Hi,
The file name is not readable is it because my ffd.cFileName is in WCHAR data type? I found in another forum. Something related to windows programming. It mention that his ffd.filename is in... |
Forum: C++ Jun 19th, 2008 |
| Replies: 21 Views: 2,694 I tried copy the whole piece of code just modifying the path in main() as below:
EnumerateFolderFS(_TEXT("C:\\Program Files\\Microsoft Visual Studio 8\\VC\\include\\*.h"));
No syntax error... |
Forum: C++ Jun 18th, 2008 |
| Replies: 21 Views: 2,694 Well, it's still the same. The name of the file still show "0012 FA54" .
Any way, I think it will good if i try to understand all those data types first before i try anything else. Never see all... |
Forum: C++ Jun 18th, 2008 |
| Replies: 21 Views: 2,694 Hi,
Now i can get the output for the type and size of the files but i cant see the name. The name is display as "0012 FA54". Actually all these don't matter. The important is i need to scan... |
Forum: C++ Jun 18th, 2008 |
| Replies: 21 Views: 2,694 Well, the syntax problem is solved now but nothing happen. The statement <if(INVALID_HANDLE_VALUE == sh)> return a true value which trigger the return.
#include <iostream>
#include <Shlwapi.h>... |
Forum: C++ Jun 18th, 2008 |
| Replies: 21 Views: 2,694 I'm not sure but is it like this?
Anyway what is the letter 'L' for?
#include <iostream>
#include <Shlwapi.h> // for PathAppend()
#include <tchar.h>
using namespace std;
void... |
Forum: C++ Jun 18th, 2008 |
| Replies: 21 Views: 2,694 Hi, Ancient Dragon
Did you try to compile? It will still have syntax errors:
1. 'strcpy' : cannot convert parameter 2 from 'LPCTSTR' to 'const char *'
2. 'PathAppendW' : cannot convert... |
Forum: C++ Jun 18th, 2008 |
| Replies: 21 Views: 2,694 Hi,
1. This is the code i get some where online. Why i get an error message stating that " error C3861: '_T': identifier not found"?
2. and where actually i should place the wildcard for me... |
Forum: C++ Jun 18th, 2008 |
| Replies: 21 Views: 2,694 Hi,
I'm still struggling to scan all the directories of the files. Tried to use the FindFirstFile() and FindNextFile() and the FindData() and PathAppend(). But having problem to understand the... |
Forum: C++ Jun 18th, 2008 |
| Replies: 21 Views: 2,694 Thanks for the super fast reply. I'll give it a try 1st. Thanks again. |