- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 2
- Posts with Upvotes
- 2
- Upvoting Members
- 2
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
32 Posted Topics
Folks, I'm having some trouble with overloading the '<<' operator for a templated class. For example, given a very simple template class like this: [code] template<class T = double> class Real { T m_value; public: Real( T val = 0 ){ m_value = val; } T get() const { return … | |
Re: I'm not a .NET programmer but according to the documentation: [code] IntPtr hwnd = process->Handle; [/code] Which compiles successfully as a CLR console program. | |
Re: First, using the same name for an argument and a global is confusing (string encoding)...if you are using it as a constant, make sure you initialize it (not all compilers will do this for you, especially in release), and remove the argument from the method declaration and definition. I don't … | |
![]() | Re: Actually, since it appears that the program scans the chessboard visually you should be able to adapt it to the 'new' chessboard layout. It's really just a matter of changing it so that it recognizes the new board and pieces. It looks like the original compiler was CBuilder; you will … |
Re: Global variables are defined in a header file (so that various cpp files that include it can see it). Setw is defined in iomanip so this must be included where needed. Also, you are trying to use an array of your class in the implementation (student) without declaring it or … | |
Re: [QUOTE=daviddoria;830897]yup, its txx. see section C.5 in this document: [url]http://public.kitware.com/vxl/doc/development/books/core/book_15.html#SEC158[/url][/QUOTE] I've seen .txx, or variants thereof, it is for compiled template files. Usually the contents of these are various things that need to be compiled to use a given template library, such as type-specific implementations of parts of the library, … | |
Re: [QUOTE=deadmancoder;826987]Hello mates, i am pretty new to this forum.. i am a midrange c++ programmer. if i have to create an IDE in c++ that involves basic drawing tools, what should i learn and where should i start?? is it a big task? can anyone explain me or direct me … | |
Re: [QUOTE=star4ker;826328]I am having trouble with this program which was solved before, but I am still having an issue with the final code. Here is the assignment prompt: Write a program that asks the user to order an ice cream treat. The user selects the type of ice cream, the type … | |
Re: the second example would work, assuming that you declare: [code] void getHours(int& input1, string& s); [/code] at the top and the definition is: [code] void getHours(int& input1, string& s) { cout << s; cin >> input1; } [/code] | |
Re: Help yes. Writing code for others, no, sorry ;P Thanx... Sean | |
Re: Okay, examine the first loop statement: [code] while(n >= n) [/code] is an obvious first problem...a variable is *always* going to be equal to itself under any competent compiler. Thanx... Sean | |
Re: What you've got works, since the if/else loop code is actually only a single statement. I would recommend, however, that you include brackets for clarity and ease of maintenance; it doesn't cost anything and it can lead to errors that can be quite difficult to identify (like the error that … | |
Re: [QUOTE=ganbree;804699]I'm trying to read a Unicode file using std::wifstream. On wintel. [code=cplusplus] #include <iostream> #include <fstream> #include <string> using namespace std; int main() { wifstream File("input.txt"); wstring Line; while(!File.eof() ) { getline(File, Line); wcout << Line << endl; } system("pause"); return 0; } [/code] And this is my output [code] … | |
Re: [QUOTE=kenji;784263]Hello, I have coded an overloaded += operator and it is giving me trouble. basic function of the operator is to add data to dynamically allocated class array which has 3 member variables. [code=CPLUSPLUS] ie. savings[i].accountNumber; savings[i].balance; savings[i].customer; [/code] I have managed to get the first part of the function … | |
Re: [QUOTE=pacx;784648]hi my application allow only native dlls.. i cant seem to use string to solve my problem..[/QUOTE] if for some reason you cant use stl, you coulc have buffers that hold up to a set amount;in other words keep a large buffer aside that holds, say 4000 characters, as soon … | |
Re: First, this is not a place for us to write your homework for you. If you have specific questions regarding C++ please post what you have written and what is not working, and we will try to help. There is now way we ca we work 'please do my homework … | |
Re: Is there a specific reason you need this from the registry? Graphics packages include this ability, as well as the ability to enumerate the different cards on a machine if there are multiple. It's much more specific info. DirectX does it, I believe that GDI+ has it, OpenGl, etc... Thanx... … | |
Re: in the call to the operator+ you use String temp; which invokes the default constructor. Thanx, Sean | |
Re: The Standard Template Library has a dynamically sizable array type, a linked list type, and generally a whole bunch of useful stuff that makes this easy, called the STL. The problem with STL is that it can be a bit confusing to people familiar with only C or new to … | |
Re: It's a bit unusual, but is one of the extensions usable for C++ header files. | |
Re: [QUOTE=Lukezzz;740072]Is there a way to Alt-F4 programatically. It will be used to close another programs window that opens wich is the topmost form on the desktop.[/QUOTE] This is not really a standardized thing, in my knowledge. For many reasons, it is usually a pretty involved platform specific thing, as terminating … | |
Re: [QUOTE=NinjaLink;723609]Hey, I need help getting this program to run. This is what I'm trying to do. a) set and store the first name only b) set and store the last name only c) store and set the middle name d) check to see if a given first name is the … | |
Re: [QUOTE=fireballnelson;721520]I am new to C++ although I have done intermediate java programming. A couple of months ago I bought a book called [I]The C++ Programming Language; Third Edition[/I] by Bjarne Stroustrup. I am beginning to think that was a mistake because it is a little over my head. I was … | |
Re: [QUOTE=Dontais;723659]I'm trying to run my program and when I enter say 3 it gives me a fatal error. It is suppose to calculate the avg of each value entered and output it. Would appreciate a little advise on this I'm stumped. The error says "warning C4700: uninitialized local variable 'sum' … | |
Re: [QUOTE=n8thatsme;723634]Ok I have a simple question I have a header file that has the following code [CODE] void setPartDecription(string partDescrip); string getPartDecription() {return partDescription;} [/CODE] Of course I have other functions but these are the problem functions and they are public. In my main function I have this: [CODE] cout … | |
Re: [QUOTE=Frankinator;723697]Suppose I were to use a code in my program very similar to this one: [url]http://www.codeproject.com/KB/IP/ftpclientclass.aspx[/url] What headers would I need to use? The tutorial doesn't state that, I downloaded their sample source codes for the compiler I use (Bloodshed) and none of the multiple example source codes' headers worked … | |
Re: [QUOTE=just11;721147]Q) Draw an inheritance hierarchy for class Quadrilateral, Trapezoid, Parallelogram, Rectangle and square.Use Quadrilateral as the base of the hierarchy. Make the hierarchy as deep as possible. Can anyone help me to create it as a proper program?[/QUOTE] Well you have the base class already: Quafrilateral. That goes on top. … | |
Hi There! Quick, probably dumb question but I have the following snippet [code] template<typename T> class Natural : public ArbitraryNumber{ std::vector<T> mVal; std::vector<T>::iterator mIter; [/code] instantiated with [code] math::Natural<long double> z; [/code] in my main module. Visual C++ dislikes this. When I put this in: [code] typename std::vector<typename T>::iterator mIter; … | |
![]() | Re: [QUOTE=tefismp;718426]Someone out there please help me i must do a function for a bucket sort but i dont know how and the only things i must use are normal arrays and pointers no strange functions and libraries i need the code in c++ please i know what the program does … |
Re: The function definition is not being included in your test.cpp module, so the linker can't find it. Often inline function definitions are saved as a different type of file (like test.inl) which is itself #include -ed. if you really need to inline something and aren't sure whether the compiler will … | |
Re: This is actually C, not technically C++, btw. You mention pointer to member functions but so far all I see is a standard function declaration and definiton. No function pointers...could you clarify? Function pointers are a standard way to deal with "callbacks", that is, they hold the address of a … | |
Re: [QUOTE=Jason123;718419]i have a 2D array of emp[20][10] How can i do it such that it only prints out the selected index like emp[0][0] to emp[0][10] etc. It will print around more than the selected.. [code=cplusplus] for(int i= 0; i < 20; i++) { for (int j = 0; j < … |
The End.