Hi, Is anyone familiar with this problem in BorlandBuilderC++: void Print(AnsiString Path){ Label1->Caption=Path.c_str(); } ... Print("C:\Directory1\Directory2\Music.mp3"); When I pass this string to Print(AnsiString) and try to display it in Label1, I lose all '' signs and text in Label1 looks like this : **"C:Directory1Directory2Music.mp3"** Why is this like that? Thank you!

Member Avatar
Member Avatar
+0 forum 2

Hi, There is short explanation of queue at cplusplus.com site which tells that queue should contain front() and back() functions. As I have tested in VC++, if I use queue from <queue> and call any of these functions for an empty queue, program crashes. Could this problem be solved by simply adding a throw, in case when queue is actually empty, so front and back would throw an exception which'd be caught by try block? ( of course I am talking about queue, one would create, as I have done) Here is my simple solution of this problem. struct Exception{ …

Member Avatar
Member Avatar
+0 forum 3

Hi, I found the examples of explicit specialization, but I have a vagueness about code: using namespace std; template<class T = float, int i = 5> class A { public: A(); int value; }; template<> class A<> { public: A(); }; template<> class A<double, 10> { public: A(); }; template<class T, int i> A<T, i>::A() : value(i) { cout << "Primary template, " << "non-type argument is " << value << endl; } A<>::A() { cout << "Explicit specialization " << "default arguments" << endl; } A<double, 10>::A() { cout << "Explicit specialization " << "<double, 10>" << endl; } …

Member Avatar
Member Avatar
+0 forum 2

Hi, I have made some sorting function based on finding largest element and swapping its place with last element of array and then searching largest element of rest of array and putting it on one place before last one and so on. I am curious about is there a name for sorting of this type? I searched [URL="http://en.wikipedia.org/wiki/Sorting_algorithm"]Wikipedia[/URL], and the most similar sorting method seems to be a Heap sort. Here is the sorting function I made: [CODE]int Biggest(int Niz[], int n){ int x= Niz[0]; for(int i=1;i<n;++i) if(Niz[i]>x) x=Niz[i]; return x; } void Sort(int *Niz, int n){ int *temp=new int; …

Member Avatar
Member Avatar
+0 forum 2

Hi, I am learning templates so I have one question for this code: [CODE]template<typename T, int Number> class Data{ T Array[Number]; public: T& operator[](int); }; template <typename T,int Number> T& Data<T,Number>::operator[](int element){ return Array[element]; }[/CODE] I wish to create specialization for that class template, for any random data type, but my knowledge allows me only to create class template specialization for template with only one parameter . So I don't understand how'd the code look for class template specialization which contains expression parameter ( int Number ). Thanks.

Member Avatar
Member Avatar
+0 forum 2

Hi, What's wrong with this code: [CODE] //Comments explain what I check int Array[9]={1,2,3,4,5,6,7,8,9}; int Integer=0; int i=8,n=0; for(int x=0;x<9;x++) cout<<"array="<<Array[x]<<endl; //Are all members ok? for(int exp=0;i>=0;i--){ Integer+=Array[i]*pow(10,exp); cout<<"Integer1="<<Integer<<endl; //Is Integer being summed fine? exp++; } cout<<"Integer="<<Integer<<endl; [/CODE] Program's function is to create an integer from array ( for example: if array has 1,2,3; it need to make integer 123 ). The problem is terrible: If I have 3-4 members of array my result will decrement during 3rd summing. If I have 5-6 members result will decrement during 3rd and 5th summing. If I have 7 members result will decrement …

Member Avatar
Member Avatar
+0 forum 14

Hi, I'm about to start making some little program with input of type string which'll later be converted into numbers, but it has to pass the check is there any non-digit character. Considering I was lazy to search for functions like that I decided to make my own header for it. So here it is, what do you think: stringcheck.h : [CODE]#include <cstdlib> #include <iostream> using namespace std; int HasChars(string mystring){ int length; length=mystring.length()-1; int cti; (char to int) while(length>=0){ cti=(int)mystring[length]-48; switch(cti){ case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: …

Member Avatar
Member Avatar
+0 forum 5

Hi, I created the class for converting decimal to binary numbers and I wish to make the Windows application but there's an error: [ICODE]E2285 Could not find a match for 'TForm1::TForm1()' [/ICODE] The source code: [CODE]//--------------------------------------------------------------------------- #include <vcl.h> #include<math.h> #pragma hdrstop #include "Unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; class Convert: public TForm1{ static unsigned int i; int conv_number[1000]; unsigned int to_bin(unsigned int); public: void convert(unsigned int); void print_bin(); Convert():TForm1(){}; }; unsigned int Convert::i=0; void Convert::convert(unsigned int number){ while(number!=0) { conv_number[i]=to_bin(number); i++; number=number/2; } } unsigned int Convert::to_bin(unsigned int y) { double z; z=fmod(y,2); if (z==1) return 1; …

Member Avatar
Member Avatar
+0 forum 1

Hi, I wish to start making Windows Applications, but I need a good compiler. Considering I work in DEVC++, I can't make buttons, textboxes and other objects that easy. I wonder if there's any compiler like BorlandBuilder for C, but for C++. That'd really help me :icon_cool: So do you have any compilers like Borland which work with C++? Thanks.

Member Avatar
Member Avatar
+0 forum 3

The End.