49,757 Topics

Member Avatar for
Member Avatar for asadullah

Here I am going to explain how to make a class so that user can create object of it on free List( heap memory) or Stack. Example 1: Object should be created Only On Heap memory.Idea is that make constructor as private so that no one create on stack. But …

0
59
Member Avatar for marcelomdsc

Given the declarations: int n; char ch1; char ch2; and given that n contains a two-digit number, translate n into two single characters such that ch1 holds the higher-order digit, and ch2 holds the lower-order digit. For example, if n=59, ch1 would equal '5', and ch2 would equal '9'. Then …

Member Avatar for marcelomdsc
0
97
Member Avatar for Roofus

I have a feeling this question might be a no brainer to all you. But is it possible to convert a string object to an istream obj. Because what I need to do is read the string expression and then calculate it using the "read_and_evaluate(istream&)" method in my if else …

Member Avatar for Roofus
0
2K
Member Avatar for Alishaikh

[code]#include <iostream.h> #include <string.h> #include <vector.h> #include <fstream.h> using std::string; using std::vector; void function(vector<string>&fn,vector<string>&fnum,vector<string>&ln,vector<string>&lnum); void main() { ifstream fin,f2,f3,f4; //First name input vector <string> fname(25); fin.open("firstname.dat", ios :: in); for( int i= 0;i<25;i++) fin>>fname[i]; fin.close(); //Second name input vector <string> fnum(25); f2.open("firstnum.dat", ios :: in); for(int i= 0;i<25;i++) f2>>fnum[i]; f2.close(); …

Member Avatar for Ancient Dragon
0
86
Member Avatar for Jennifer84

I have this code that opens a Form. This code does work but if I just close the Form that did open with this code and press the button5 again, I will have an Errormessage: [B]"Cannot access a disposed object. Object name: ´Form2´."[/B] But if I change: this->form2instance.Show(); to: this->form2instance.ShowDialog(); …

Member Avatar for Jennifer84
0
134
Member Avatar for Jennifer84

I have a Form witch scrollbars that is called Form2. Is there any way to programatically go to the top of the Form without having to scrollup with the mouse ? So if you have scrolled down to the end of the form. Is it possible to press a button …

Member Avatar for Jennifer84
0
176
Member Avatar for Roofus

Hi guys, I was wondering if I could get some help on the topic of recurrsion. A week ago i was told to create a application using nodes. this week I need to convert the reverse_list fuction I made below into using recursion. any help would be great thanks. not …

Member Avatar for Roofus
0
133
Member Avatar for Kadence

Is there any difference between regular expressions in C++ and in PHP/Perl? Or can one use the same regular expressions in C++ as in PHP?

Member Avatar for twomers
0
45
Member Avatar for Phan

I haven't been on the forums for over like 20 days because I have been busy with things, and then my internet died. Not that anyone cared, but I'm just saying this so Vmane won't think that I just copied his code solution and ran away if he stumbled upon …

0
102
Member Avatar for gazoo

Hello Everyone, I'm new to the forum, currentely I'm taking the basic C++ class and struggle through, it has been over 20 years since write any codes. I have some trouble with the code below, it work fine if I don't bother to check for leap year, but the assignmnet …

Member Avatar for tesuji
0
878
Member Avatar for farag

I write an application by C++ language and I used CGI to make the Interaction by a web page so I found problem that every once I use The web page that I created by C++, C++ application program run from it's First point so I want a solution for …

0
143
Member Avatar for En1ro

[CODE=C++]struct gydytojas { int gydid, amzius, specialyb, telefonas, asmkod; String vardas; String pavarde; String adresas; friend ostream& operator<<(ostream& os, const gydytojas& obj) { os << obj.vardas.c_str() << obj.pavarde.c_str() << obj.adresas.c_str() << obj.gydid << obj.amzius << obj.specialyb << obj.telefonas << obj.asmkod; // Print the members to os like you would to …

Member Avatar for En1ro
0
135
Member Avatar for Jennifer84

I am running this loop where I am substr a vector like below and then ´creating´ a new string "NewData" that I will pushback in a new vector. The thing is that I got an Error message when running this code but if I instead change these 3 lines to …

Member Avatar for Jennifer84
0
118
Member Avatar for savinki

i want to convert stringstream into a string type e.g. [code] void countParameters(stringstream p_InputDataToCount, unsigned int &counter, char Delimeter) { size_t found; //stringstream convert ( p_InputDataToCount ); //convert>> std::hex >> m_nCommandID; //I want to do somethong like this found=[COLOR="Red"]p_InputDataToCount[/COLOR].find_first_of(Delimeter); while (found!=string::npos) { counter++; found=[COLOR="red"]p_InputDataToCount.[/COLOR]find_first_of(',',found+1); } }[/code]

Member Avatar for vijayan121
0
164
Member Avatar for Plasmarobo

This is mildly aggravating, but my flex and bison generated files won't compile under Visual Studio C++ 2008. It has to do with some of the structures (yyval for starters) and some apparently loose characters in the files. I'll post the compiler output, but this is my third day of …

0
74
Member Avatar for Nemoticchigga

I am trying to read from a serial port using System::IO:: Ports in visual studio 2005. I can write fine, but reading isnt reading in anything to the buffer. I am using the following code, similar to the way i was writing to the port. [CODE]array<unsigned char>^ messageBuf = gcnew …

0
51
Member Avatar for savinki

i m getting this error. but i couldnt identified where i have gone wrong. could someone explained, normally in which situations this type of error occurs. Error 1 error C2248: 'std::basic_ios<_Elem,_Traits>::basic_ios' : cannot access private member declared in class 'std::basic_ios<_Elem,_Traits>' c:\program files\microsoft visual studio 8\vc\include\sstream 513

Member Avatar for William Hemsworth
0
65
Member Avatar for manzoor

how do you find the smallest and largest number of 3 numbers without using logical operators and else statement only if and relational operator ? is there any other way without checking every variable against each other using if statements ?

Member Avatar for William Hemsworth
0
101
Member Avatar for ro4782

I have tried eveything to count the reccurrence of just the word hello. I open a file and can count the words in the textbox but can't count just the on word that i want. Please help with this problem. thanks

Member Avatar for William Hemsworth
0
98
Member Avatar for Snaku919

Euhmm Ok i got some error that tells me that i can't open the program because there some error in my syntax but I really don't know where is the problem it self. #include <iostream> #include <iomanip> #include <cmath> #include <fstream> using namespace std; void voircatalogue(fstream&); void ajoutitem(fstream&); void ajoutclients(fstream&); …

Member Avatar for Snaku919
0
244
Member Avatar for savinki

In windows getline(,,) returns *this. And Errors are signaled by modifying the internal state flags e.g. eofbit, failbit, badbit. e.g. No characters were extracted -> then state flag = failbit I want to do erro handling to this. since this retuens pointer how can i do this. Can some one …

Member Avatar for Nick Evan
0
91
Member Avatar for manzoor

ok in what way do you separate the digits from a given int ?? like if the int is 987987 how do you separate them in to 9 8 7 9 8 7 ??? is there any function to do this ?

Member Avatar for manzoor
0
80
Member Avatar for timdog345

[code] void firstClass(int f); void businessClass(int b); void coachClass(char typeTicket); int main() { char type; cout<<"Please enter your which class you want to fly. (f=firstClass, b=businessClass, c=coach)"; cin>>type; cout<<endl; //bad data check while (type != 'f' && type != 'F' && type != 'b' && type != 'B'&& type != …

0
228
Member Avatar for xlx16

mybe i should ask my question in another way. question: we want to make a text editing program, first of all how we can make a space for user to write in it(make an arry with a lot of space exp:char txt[1000]; ?!!!) secend ,this program suppose to do flowing …

Member Avatar for Nick Evan
0
99
Member Avatar for farag

I write an application by C++ language and I used CGI to make the Interaction by a web page so I found problem that every once I use The web page that I created by C++, C++ application program run from it's First point so I want a solution for …

0
80
Member Avatar for paradox814

I am stuck on something that I know is so simple that I can't figure it out... I have a BST class, and a private item: [code]Node<K> *root; // root pointer //and in a seperate class I have... template <typename K> class Node { public: // constructors Node() {}; Node(const …

Member Avatar for bugmenot
0
231
Member Avatar for StrawberryChips

First off I'd like to say I'm a beginner in C++ (VB was my stronger point I think), so be gentle about how gigantic my code is. I've been working on a project for a class for a couple days now, it's not due for a couple days, but for …

Member Avatar for Agni
0
283
Member Avatar for blainer27

Hi, I'm currently in a C++ class and I have this one problem where you are supposed to try and create a calculator which will take the equation like this: (-insert equation here) = I can't seem to get it to work for the life of me! I was just …

Member Avatar for Salem
1
75
Member Avatar for toolbox03

I have a txt file of this format: 2 Jack S123 Y 1 Choco P0001 5.50 2 Jane S456 N 2 Rice P0002 10.00 2 Chicken P0004 7.50 1 how do i create the loop to store the data into 2 classes? my code for (int i = 0; i …

Member Avatar for VernonDozier
0
104
Member Avatar for hmaich

Hello all, I have a doubt concerning to overloaded operators. Does the compiler create new temporary object to the elements involved on the overloaded operation? E.g. Operator + overloaded. a = b + c; Does the compiler creat temporary object for b and c? See the following code and the …

Member Avatar for Duoas
0
112

The End.