Forum: C++ 9 Hours Ago |
| Replies: 3 Views: 58 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 What is the problem? What have you tried to resolve the problem? |
Forum: C++ 1 Day Ago |
| Replies: 8 Views: 155 What do you mean by "it doesn't work"? |
Forum: C++ 1 Day Ago |
| Replies: 1 Views: 93 >>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 Views: 155 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 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 |
Forum: C++ 3 Days Ago |
| Replies: 9 Views: 125 No
int main()
{
int i;
string list[10];
int Quantity = 0;
string line; |
Forum: C++ 3 Days Ago |
| Replies: 10 Views: 196 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 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 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 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 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 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 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 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 >>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 >>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 I have no idea how to do that. |
Forum: C++ 3 Days Ago |
| Replies: 16 Views: 264 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 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 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 Yes, Clinton, that is one way to do it -- the hard and grossly inefficient way. |
Forum: C++ 3 Days Ago |
| Replies: 4 Views: 230 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 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 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 >>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 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 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 My error, I had the parameters backwards. This will fix it getline(in, line1); |
Forum: C++ 4 Days Ago |
| Replies: 1 Views: 163 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 Post the entire program, not just little pieces. |
Forum: C++ 4 Days Ago |
| Replies: 9 Views: 247 You failed to include <string> header file. |
Forum: C++ 4 Days Ago |
| Replies: 7 Views: 186 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 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 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 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 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 Where is the code you have written to solve that problem??? |
Forum: C++ 5 Days Ago |
| Replies: 1 Views: 168 line 71 contains a syntax error. See if you can find it. |