- Strength to Increase Rep
- +6
- Strength to Decrease Rep
- -1
- Upvotes Received
- 32
- Posts with Upvotes
- 26
- Upvoting Members
- 7
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
Datta, Dayadhvam, Damyata
non quasi imperans dico sed per aliorum sollicitudinem etiam vestrae caritatis ingenitum bonum conprobans
Re: Make sure you created a Win32 project and not a console project (how to do that depends on your IDE) | |
Re: You shouldn't have to bother with all that, since InternetOpenUrl expects LPCTSTR (typedef as const TCHAR*) as its second argument. Try: [code] hFile = InternetOpenUrl( hINet, sUrl.c_str(), NULL, 0, 0, 0 ); [/code] | |
Re: Well, it seems likely the problem is in one of the two parameters you pass to the LoadBitmap function. You should check the return value of GetLastError after LoadBitmap fails, and look it up [url=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/system_error_codes.asp]here[/url]. | |
Re: Do you mean the length of a c-style string (char array) or the length of a std::string? You could use strlen for the former, and the length() member function for the latter | |
Re: [code] string input; while (!ifile.eof()) { getline(ifile,input); cout << input << endl; } [COLOR=red] ifile.seekg(0,std::ios::beg); //reset read pos to beginning ifile.clear(); //clear eofbit [/COLOR] while (!ifile.eof()) { ifile.get(ch); cout << ch; } [/code] | |
Re: A major difference that hasn't been noted (unless I just missed it) is that 2005 uses C++/CLI for .NET programming, whereas 2003 uses the older managed extensions for C++. Just to clarify, C++/CLI is essentially its own language, though it is based on C++. Also, all the express versions are … | |
Re: [quote=~s.o.s~;333350]> In C. It's not a good idea to use that in C++, use cin.get() instead. Any good reason to back that up ? ;)[/quote] According to the standard, the c header files are deprecated, meaning they might be removed from the standard in future revisions. | |
Re: [code] Entry *entry; entry = [COLOR=#0000ff]new[/COLOR] Entry(media, entertainment); [/code] What are you trying to do here? You've already assigned the private members of the class (_media and _entertainment). And once the function returns, the newly allocated Entry object is lost (memory leak) | |
Re: In addition, you may want to search for "functor" or "function object" for more information. | |
Re: It's not an "abnormality," it's actually part of the C++ standard. As I understand it, operators like 'and' and 'or' are included for users with different character sets. See: [URL]http://david.tribble.com/text/cdiffs.htm#C99-alt-tok[/URL] Microsoft compilers appear to implement these as macros instead of keywords in the ciso646 header. As for the second part … | |
Re: Could you post a short program that demonstrates the problem (and that we can actually compile)? | |
Re: Since it appears you are using managed (.NET) code, why not use the .NET classes for file IO? I'm no expert at C++/CLI but it might be as simple as: [code] System::IO::StreamWriter^ sw = gcnew StreamWriter("file.txt"); sw->WriteLine(txt1->Text); [/code] | |
Re: The first part looks ok to me, but for the second part you also need to allocate space for each pointer in the array | |
Re: If you're going to use std::find like that, you need to define an equality operator for your info class: [code] class Info { public: bool operator==(const std::string& first_name); //... } [/code] However, you may want to use std::find_if instead. find_if allows you to specify an unary predicate as the matching … | |
Re: What do you expect to happen? After you increment 'p' in your third loop, it points past the last element of the array, so you're bound to get garbage data on your last outputs. | |
Re: Try indenting/using code tags (some IDEs can even indent for you!): [code] #include <iostream> #include <string> #include <iomanip> using namespace std; int main() { // Declare Variables int withdraw; string name; double acctbalance, deposit; char choices; acctbalance = 0; //inputs, get the name and initial balance cout << "Enter Name: … | |
Re: hand appears to be a 2-dimensional array, in which case you need to compare each element (if you use only one subscript, you're comparing a pointer to an integer) [code] if (hand[i][0]==1 && hand[i][1]==2 && /*...*/) [/code] Of course, the problem here is that the cards may not be in … | |
Re: Is that table correct? I would think that you should start with two rabbits, then the number should double each month (i.e., exponential growth of 2^x) | |
Re: Any particulary reason you're writing procedural code in C++? A better approach would be to create a tree class that handles everything. Anyways, one major problem you have is that you pass a single pointer to traverse. The pointer in traverse is local to the function, so setting [inlinecode] current … | |
Re: Your code shouldn't even compile. You're missing a using declaration (I assume) and main should return 'int' Also, you should use std::stringstream instead of strstream (I believe the latter is deprecated) | |
Re: [quote=hoosier23;258055] What is the logic behind using float SavingsAccount::annualInterestRate = 0; right before my main? I see that you are setting annualInterestRate to zero, but why does this need to be done? Afterall, I have made annualInterestRate .03 in the default constructor. [/quote] I believe static variables will be automatically … | |
Re: Look at [URL="http://www.cplusplus.com/ref/iostream/ifstream/"]std::ifstream[/URL]. E.g.: [code] #include <fstream> #include <string> //... std::ifstream infile("somefile"); if (!infile.good()) { //failed to open } std::string line; std::getline(line,infile); //read a line into std::string [/code] | |
Re: Looks like a decent start. You just need to find a way to get the correct subscript into 'deck' to assign values in the inner loop, and then figure out how to shuffle the deck. The simplest way to do the last part is probably std::random_shuffle. You might also consider … | |
Re: How exactly are you linking this? I see you have two entry points (in pointTypeImp.cpp and circleTypeImp.cpp) and circleTypeImp.cpp relies on code from pointTypeImp.cpp. Obviously, though, you aren't linking these two files or you would have a multiple definition error for main. Generally, you should have separate files that contain … | |
Re: > One more thing, if i can't call main() recursively, can u suggest me any other way to call the main just after finish other function. You don't need to call main; when your function finishes, it returns the calling function. If you need the code to repeat, use a … | |
Re: Maybe there's a problem with your compiler/IDE installation or with the header files. Also, make sure your code is being compiled as C++ and not C | |
Re: How about reformmating that/adding code tags? | |
Re: Some more info can be found here: [URL]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/windows_data_types.asp[/URL] Namely, it says that WINAPI and CALLBACK are both defined as __stdcall (it might not help you much, but [URL="http://msdn2.microsoft.com/en-us/library/984x0h58.aspx"]this[/URL] explains different MS specific calling conventions) | |
Re: Could you post a short example program that we can compile, and that demonstrates the problem? | |
Re: Try pressing alt-tab. It might appear elsewhere as well, but I can't think of where at the moment. |