Search Results

Showing results 1 to 40 of 1000
Search took 0.16 seconds.
Search: Posts Made By: Ancient Dragon ; Forum: C++ and child forums
Forum: C++ 9 Hours Ago
Replies: 3
Views: 58
Posted By Ancient Dragon
No you don't have to use () on your own c++ classes.

class MyClass
{
public:
MyClass() { cout << "Hello World\n"; }
};

int main()
{
Forum: C++ 1 Day Ago
Replies: 1
Views: 121
Posted By Ancient Dragon
What is the problem? What have you tried to resolve the problem?
Forum: C++ 1 Day Ago
Replies: 8
Solved: Timer
Views: 155
Posted By Ancient Dragon
What do you mean by "it doesn't work"?
Forum: C++ 1 Day Ago
Replies: 1
Views: 93
Posted By Ancient Dragon
>>Is it incorrect to pass "hFind" as the first parameter to GetFileTime()?

No. You need to read msdn for the functions you want to use. Read this...
Forum: C++ 2 Days Ago
Replies: 8
Solved: Timer
Views: 155
Posted By Ancient Dragon
How do you know Sleep() doesn't work?? Recall the parameter is milliseconds -- there are 1000 milliseconds in one second.
Forum: C++ 2 Days Ago
Replies: 6
Views: 403
Posted By Ancient Dragon
You might as well delete the loops on lines 4-10 because that initialization is just undone (destroyed) by line 29.
Forum: C++ 3 Days Ago
Replies: 10
Views: 196
Posted By Ancient Dragon
yes, that's ok too.
Forum: C++ 3 Days Ago
Replies: 9
Views: 125
Posted By Ancient Dragon
No

int main()
{

int i;
string list[10];
int Quantity = 0;
string line;
Forum: C++ 3 Days Ago
Replies: 10
Views: 196
Posted By Ancient Dragon
No, the int means the function returns an integer. The void means main() does not have any parameters.

There are three ways to code main(). Any other way is non-standard and may or may not be...
Forum: C++ 3 Days Ago
Replies: 10
Views: 196
Posted By Ancient Dragon
In c++ int main() and int main(void); are the same thing. You are free to code it either way, unless your teacher tells you otherwise.
Forum: C++ 3 Days Ago
Replies: 9
Views: 125
Posted By Ancient Dragon
1) use getline(), not >> to read each line of the time.

2) you have to put the line that was read into an array of some kind. Line 42 just mearly counts the number of words read and toss out the...
Forum: C++ 3 Days Ago
Replies: 10
Views: 196
Posted By Ancient Dragon
That is Microsoft and they do whatever they want. Microsoft does NOT control the C/C++ standrds committee. Other compilers will (or may) produce errors because void main() is non-standard.
Forum: C++ 3 Days Ago
Replies: 9
Views: 125
Posted By Ancient Dragon
You are trying to do it the hard way

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>

using namespace std;
Forum: C++ 3 Days Ago
Replies: 10
Views: 196
Posted By Ancient Dragon
Never ever recommend void main() because it isn't recognized by either C or C++ standards. Read this article (http://users.aber.ac.uk/auj/voidmain.shtml).
Forum: C++ 3 Days Ago
Replies: 6
Views: 136
Posted By Ancient Dragon
To see if unicode, goto menu Projuect --> Properties --> expand the Configuration Properties tab, select General. Now check the value of "Character Set" -- if its set to "Use Unicode Character Set"...
Forum: C++ 3 Days Ago
Replies: 6
Views: 136
Posted By Ancient Dragon
Are you compiling for UNICODE? If you are, then try making filename a TCHAR instead of char*

TCHAR filename[] = TCHAR("C:\\Windows\\filenamehere.exe");...
Forum: C++ 3 Days Ago
Replies: 6
Views: 136
Posted By Ancient Dragon
>>sizeof("C:\\Windows\\filenamehere.exe");

That will not produce the value you want -- the sizeof(any pointer here) is the same for all pointers (most likely 4). It would be easier to just...
Forum: C++ 3 Days Ago
Replies: 16
Views: 264
Posted By Ancient Dragon
>>I've already got two main
Programs can only have one main(). Delete one of the two you have.

Create another function and move the code you posted in main into that function. Then change main...
Forum: C++ 3 Days Ago
Replies: 4
Views: 144
Posted By Ancient Dragon
I have no idea how to do that.
Forum: C++ 3 Days Ago
Replies: 16
Views: 264
Posted By Ancient Dragon
You already have all the code you need -- just put it in a function, return the result.

int foo(int x)
{
// put code here
}

int main()
{
int x = foo(5);
Forum: C++ 3 Days Ago
Replies: 4
Views: 144
Posted By Ancient Dragon
what "catch" ? There are lots of them on the computer. You can't get access to most of them because they are part of the os.
Forum: C++ 3 Days Ago
Replies: 3
Views: 182
Posted By Ancient Dragon
Your memory is a little fuzzy -- its just the opposite.
MS-Windows/MS-DOS: \r\n
*nix: \n
MAC: \r



I don't get an extra character on MS-Windows. getline() does not append the line...
Forum: C++ 3 Days Ago
Replies: 4
Views: 230
Posted By Ancient Dragon
Yes, Clinton, that is one way to do it -- the hard and grossly inefficient way.
Forum: C++ 3 Days Ago
Replies: 4
Views: 230
Posted By Ancient Dragon
Read the file sequentially from beginning to end, counting lines as you go along. If you want to read the 2d line then you will have to read lines 1 and 2. It is not possible to skip to a specific...
Forum: C++ 4 Days Ago
Replies: 16
Views: 264
Posted By Ancient Dragon
I already posted example (not code). Just create a loop and keep running counter of current sum.
Forum: C++ 4 Days Ago
Replies: 16
Views: 264
Posted By Ancient Dragon
Must mean integers, because there are an infinite quantity of floats or doubles between two numbers. The word amount is ambiguous. Does it mean sum or quantity ? For example, there are 11 numbers...
Forum: C++ 4 Days Ago
Replies: 1
Views: 126
Posted By Ancient Dragon
>>Thanks in advance !

Dump vc++ 6.0 -- its old, outdated and does not support c++ very well.

Another suggestion: Go to www.winpcap.org, click on their Support link and join their mailing...
Forum: C++ 4 Days Ago
Replies: 5
Views: 188
Posted By Ancient Dragon
Read both files at the same time as firstPerson mentioned, then compare the lines as they are read; no need to put them in a vector unless you intend to do something else with them.
Forum: C++ 4 Days Ago
Replies: 9
Views: 247
Posted By Ancient Dragon
What compiler do you use? The problem most likely is caused by not adding something at the end of the program that makes it wait for keyboard input so that you can see what's on the screen. Add...
Forum: C++ 4 Days Ago
Replies: 9
Views: 247
Posted By Ancient Dragon
My error, I had the parameters backwards. This will fix it getline(in, line1);
Forum: C++ 4 Days Ago
Replies: 1
Views: 163
Posted By Ancient Dragon
Forget Turbo C -- its too old. Code::Blocks might work since it used MinGW which is the same compiler that's probably used on *nix, only the compiler was ported to MS-Windows, and it supports many...
Forum: C++ 4 Days Ago
Replies: 9
Views: 247
Posted By Ancient Dragon
Post the entire program, not just little pieces.
Forum: C++ 4 Days Ago
Replies: 9
Views: 247
Posted By Ancient Dragon
You failed to include <string> header file.
Forum: C++ 4 Days Ago
Replies: 7
Views: 186
Posted By Ancient Dragon
Your head is wrapped around it wrong. I don't know how you got 19 mpg -- 160.9/3.27 is 49, not 19.
Forum: C++ 4 Days Ago
Replies: 9
Views: 247
Posted By Ancient Dragon
1) use ifstream, not fstream, to read a file. ifstream is easier to use.

2) use getline() to read an entire line that may or may not contain spaces.

ifstream in("test.txt);
getline(line1,...
Forum: C++ 4 Days Ago
Replies: 3
Views: 152
Posted By Ancient Dragon
Of course you can't really delete an element in an array, just shift all remaining array elements up to write over the element you want deleted and leave an empty element at the end of the array. If...
Forum: C++ 4 Days Ago
Replies: 1
Views: 151
Posted By Ancient Dragon
You can't just simply add gui to a console app. Start out by creating an MFC application (not a console app that supports MFC, but a regular MFC program, then choose either dialog (probably what you...
Forum: C++ 4 Days Ago
Replies: 2
Views: 126
Posted By Ancient Dragon
string resides in std namespace and you have to tell the compiler what namespace it's in. You have several options (use only one of the options listed below)

using namespace std; put that after...
Forum: C++ 5 Days Ago
Replies: 3
Views: 155
Posted By Ancient Dragon
Where is the code you have written to solve that problem???
Forum: C++ 5 Days Ago
Replies: 1
Views: 168
Posted By Ancient Dragon
line 71 contains a syntax error. See if you can find it.
Showing results 1 to 40 of 1000

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC