That is a poorly written program becuse it passes the vector to PlayWithStrings() by value instead of by reference, causing the program to duplicate the entire vector on each entry to that function.
What compiler and operating system are you using?
That is a poorly written program becuse it passes the vector to PlayWithStrings() by value instead of by reference, causing the program to duplicate the entire vector on each entry to that function.
What compiler and operating system are you using?
If you put car.h in the same folder as car.cpp the compiler should not have a problem finding it. If you put car.h in some otherr folder you will have to tell the compiler where it is, as stated by other members who have posted here. For small projects just put everything in the same folder unless you are instructed to do otherwise by your teacher.
please post the first few errors.
I don't see how to endorse someone any more. I think it was yesterday that there was a link in the member's profikle just above Rep grap, but that's gone now. When I click Skill Endorsements all I see is a list of people who have endorsed that member.
[edit]Nevermind. I found the answer here
I notice Ancient Dragon is the only member that has 5 checks.
Look again. There are several threads here in Community Feedback with 5 checks that I did not start.
Just wondering how 'easy' it is for non-mods to endorse somebody not in the 'suggestions' list.
Just as easy as it is to endorse anyone else. Just click the member's/mod's avatar then his/her name appears in the list.
I see that the list changes each time you click on your profile and whenever you refresh the browser when it's already in your profile. Wouldn't it be easier to just give us a complete list and let us check the members we want to entorse? Or is the complete list all 1,000,000 DaniWeb members?
testing bump
I am concerned that this will lead to people posting "bump" and other such empty content just to get their names in the bar.
Nope. It apparently doesn't work like that. once the thead is marked solved the bar doesn't change when new posters add to the thread. I just tried it.
macs are overpriced too -- two to three times more expensive than PCs.
And did it make you think windows is better mac os x operating systems?
Anything is better than mac os x :) I have a friend that has it on a notebook, always crashing and corrupting files.
vector<string> db(string input)
That function doesn't return anything.
your test() is doing too much work! The solution is much simpler.
void test()
{
double x;
double y;
double z;
#if 0
cout << "Enter price 1:";
cin >> x;
cout << "Enter price 2:";
cin >> y;
cout << "Enter price 3:";
cin >> z;
#endif
x = 5.0;
y = 50.0;
z = 500.0;
cout << fixed << setprecision(2);
cout << "$" << setw(20) << right << x << endl;
cout << "$" << setw(20) << right << y << endl;
cout << "$" << setw(20) << right << z << endl;
}
// I tied this too didnt work
I think the problem is that MFC doesn't have a chance to process the message(s) until after that function returns. You need to add your own message pump after that line (see this article for full explanation).
MSG msg;
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg); // send to window proc
}
on line 40 the parameters to removename() are reversed, you have them backwards.
Are you trying to create a 2d array of integers where each dimension is the same size? Here's how to do it. (It's spelled int, not Integer)
Think of a 2d array much like a chessboard which has rows and columns. The rows are the first dimension and the columns are the second dimension. Before you can allocate the columns you have to allocate the rows.
const int size = 4;
int** twod = new int[size]; // rows
for(int i = 0; i < size; i++)
twod[i] = new int[size]; // columns
Now, then you destroy that you do it in reverse order, that is delete[] the columns first and then the rows.
Team College is someone who is no longer a mod or admin. I was a mod for several years, then decided to quit.
Do you see the Mod or Admin badge beneath my avatar???
I think the yellow folders are the ones you have never posted in.
Right, I was looking at Activity Points, not position in the list. At any rate, you are a long ways above me. Happygeek may be #1 because of all the time he spends on doing his mod stuff.
Are you looking in the right column? I'm #36 in the list today and you are #2.
Is there any way of running and compiling with known errors in the code.
Compiling? yes, running? No because the program has to be error-free in order to execute the code. There is no point in trying to execute a program that contains compile-time errors. How do you expect the compiler to generate executable code when the source code is crap?
Do you really need references to both versions of word at the same time? If you have the reference to word 2010 just test your program on a computer that has word 2008 installed on it.
why is it that the c2.LunchTime() triggers the copy constructor?
Because the function is returning an object and the only way to return it is by making copy of it. If you changed it like this then the copy constructor would not get called because the function would return a reference to itself.
Clock& Clock :: LunchTime () {
hr = 12;
min = 0;
sec = 0;
return this ;
}
It doesn't matter how you exported it or what lib you linked to since you can't create a vector in a dll and expect to destroy it in the application program because of heap differences. Won't work. You need another method in the DLL that will destroy the contents of the vector when no longer needed.
std::vector<std::string> Editor::StringHandler::Split(std::string data, std::string tokens)
You don't want to return a vector like that because it has to be duplicated when returned, which can be very very time consuming. Instead, pass a reference to the vector as a parameter so that Split can just modify it. Return either void or maybe bool to indicate success.
bool Editor::StringHandler::Split(std::vector<std::string> & returnList, std::string data, std::string tokens)
New memory allocated in a DLL must be deallocated in the DLL. You can't allocate memory in a DLL then deallocate it in the application program because the two have different memory heaps.
Here is another thread on that topic.
Read this article to understand namespaces.
cout and cin replace printf() and scanf() respectively. Which is better? c++ program should generally use c++ conformant functions and classes. Although most C functions can be used in c++ programs, it is customary to use c++ functions whever possible. If you are more comfortable with C functions such as printf() then you might want to confinue using them while learning c++ language, then change over gradually to c++ cin function.
There are several ways to correct the problem: add using std::cout after the includes and before any functions, or on line 6 use std::cout
What version of Visual Studio are you using? M$ dropped support for c++ Windows
Forms in VS 2012.
textbox.Text = "something" will set the text in a textbox, read this link for all properties/methods.
So to make the calculation just convert the text in the textbox to an int, make calculations, convert result to a string, and assign back to the textbox. Since you are working with CLR/C++ I assume you already know how to to most of that.
Just take the original file name and append something to it
std::string name = "Hello";
std::string newname = name + "There";
ofstream out(newname.c_str());
Or, if you want to keep the same name just put the new file(s) in a different folder by appending the new path to the folder to the beginning of the file name.
I voted for Micky Mouse for President and Popeye as VP.
Can you only enter alph characters such as 'a' to 'z', no caps or other special characters?
for(int value = 0; value < strlen(userInput); value++)
calling strlen() in a loop like that is poor programming practice because the return value never changes and its time consuming. Here is a better way to code that loop
for(int value = 0; userInput[value] != '\0'; value++){
But you have to tell the compiler which library file (.lib) to link to.
CB uses gcc compiler/linker so libraries are the same as *nix, which are *.a, not *.lib, so you might have a library named libmylib.a. The name of the libraries are compiler-dependent, many MS-Windows compiler such as Microsoft and Borland use *.lib as previously explained by dx9, but CB does not.
No, search option only tells the linker where to find them. Add library names in Project --> Build Options --> linker settings tab.
If you use relative path then your project may not work because some *.cpp files are in different folders so the relative locations will change depending on the location of the *.cpp files. Use full paths and it should be ok.
There probably is a statistical lib somewhere, just google for it.
I don't want to get another thread's message.
My misunderstanding. In that case yes, CWinThread will probably work. As for worker threads, you can put a message pump into them so that they can receive messages. Not usually done though.
There is no float named monthlyInterest, maybe you are thinking monthlyInterestRate??
line 23 declares a variable of type float named monthlyPayment, not a function named monthlyInterest().
The error(s) reported by vc++ is because the compiler is compiling the source files as c++ instead of C. In C the return value of void* functions such as malloc() do not need to be typecast, but in c++ they do. This is a requirement of the C and C++ ISO standards. Your source file has *.cpp extension as indicated in the error message, so it's being compiled as c++. Change the extension to *.c and the erorr(s) will go away.
I suspect gcc does not complain because you named the source files with *.c extension instead of *.cpp
In VC++ 2008 after creating the c++ project you have rename the files with *.c extension.
line 34: where is function monthlyInterest() prototyped?
Yup, rewrite the entire file , replacing the line you need to change.
depends on how the file is written. If its a simple text file then you will most likely have to completly rewrite the file.
Don't you have the slightest idea how to write MFC program? Or use VC++? If not, then google for tutorials. I already gave you lots of links, its up to you to study and learn.
vcvars32.bat doesn't know anything about the folder(s) where the SDK is installed. you will have to create another batch file that adds those paths to the environment variables or use /I<path> on the cl command line.
If you zip up the project files and email or PM them to me I'll try to compile it. (I just sent you a PM)
I assume that code is drawing an arrow on a button. If that's true then put the code in the button's OnClick event handler.
you want the arrow to appear on a button, right? Study the links I gave you and they will tell you how to do it.
you need to run vcvars32.bat found in the compiler's bin folder, similar to this (for vc++ 2012):
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin
If you are using Windows 7 then I suspect you are trying to use an outdated SDK. Get this one. But in most cases you don't need the SDK because the compiler includes most, if not all, the windows headers and libraries that are needed. You should try to compile without reference to the SDK to see if your program will compile.
I read the string back to decrypt, does not give the whole string back but truncate the string.
Then you are opening the file incrrectly. Since the file contains embedded NULL bytes it must be opened in binary mode and use std::string's read() method.
when decrypting I can avoid them?
You can't just ignore them because they are part of the encryption algorithm. Decryption will be rendered useless without them.