51,593 Topics

Member Avatar for
Member Avatar for nanchuangyeyu

Hi, I know the return value of generic search algorithm "find()" is of iterator type. Now how can I output the return value as numeric type? For example: [CODE] short myArray[4] = {2,1,3,7}; vector<short>mVec(myArray,myArray+4); vector<short>::iterator found; found = find(mVec.begin(),mVec.end(),2); [/CODE] In this code the variable found will be assigned the …

Member Avatar for StuXYZ
0
269
Member Avatar for rmlopes

Hi everybody, I am having some problems with a multi-threaded application I am developing. I get segmentation faults in different places, always related to std::string, using g++4.3.2 on Ubuntu 8.10 server. Here is an example: [icode] #0 0xb7e18bb6 in memcpy () from /lib/tls/i686/cmov/libc.so.6 (gdb) up #1 0xa8eb1014 in ?? () …

Member Avatar for ganbree
0
166
Member Avatar for anupjp

Hi Guys, I have written a windows c# service that basically write out some text to a file in the onStart function. The program works fine when i manually start or stop it. Now if i leave it started and restart my system, the service does not seem to do …

Member Avatar for thewebhostingdi
0
2K
Member Avatar for doublebond

Hi Guys, Need some help....... I want 2 read a huge file which contains binary data. Is it possible for me to make use of hash tables to read the same? if so, how can I do it. If the key value of the hash function is and integer we …

Member Avatar for Tom Gunn
0
122
Member Avatar for fifarunnerr

Hello everybody, I started c++ half a year ago, with the .cpp programs. Now i want to create a program with the Windows Application forms. But how can i multiply with textboxes? I want something like: textBox1->text = (textBox2->text * 3) But this code gives an error, i need something …

Member Avatar for Salem
0
49
Member Avatar for narendrachandu

3. Create a class by vector with an array of” int” type as its member data (The array created dynamically)find the last largest and avg value of the vector 4. Explain the sequence of steps to be followed in performing the following operations over a binary file catching of empty …

Member Avatar for ~s.o.s~
0
207
Member Avatar for kingben

[code=c++] #define MIN_PASS_LENGTH 6 #define MAX_PASS_LENGTH 12 #define NUMBER_OF_PASSWORDS 3 #include<iostream.h> #include<stdlib.h> #include<time.h> #include<conio.h> #include<fstream.h> #include<string.h> //int i; //letters //int j; //numerals char rand_small_letter() { int nHigh = 122; int nLow = 97; int small_letter = ((rand()%(nHigh - nLow + 1)) + nLow); //values from 97 to 122 return (char)(small_letter); …

Member Avatar for tux4life
0
883
Member Avatar for adamdk

I have not yet started this, I want some advice on how to proceed before I waste too much time! I am writing a Service which listens on a COM port, parses input, and stores relevant data to a database. I am fine with all of this, except I need …

Member Avatar for sknake
0
124
Member Avatar for dumdumsareyum

I wrote this program back in high school 10 years ago and I found it today. I'm getting back into programming and I'd like to get it working again, some of the headers are deprecated which I tried to fix, and I was using borland c++ and now have Dev …

Member Avatar for Salem
0
151
Member Avatar for VBNick

Hello~! ...again.. I got some help from you guys a while ago with this same app because it wouldn't run on winxp. It runs fine now, but my brother is still telling me he cant get it to work right...so rather than go through all the trouble of trouble shooting(he …

Member Avatar for Salem
0
258
Member Avatar for narendrachandu

1. Create a class by name student with the necessary member data provide the facility. A. Create a list of stack B. search a student by reg.no 2. Create a class by name dates A. overload “<” operator to compare two dates B .overload “++” operator to compare date by …

Member Avatar for Salem
0
215
Member Avatar for nanchuangyeyu

Hi, I am now using VS2005 to write a console program. Since the [CODE]int main(int argc, char** argv) [/CODE] function is designed to accept parameters, how can I pass them to the program while debugging in step by step mode?thank u in advance.

Member Avatar for tux4life
0
89
Member Avatar for metzenes

I'm developing a recursive method for a class which will return a complicated data structure (a list of dictionaries which will contain lists of dictionaries as values). The data structure could be something like that: list<map <string,list<map <string,list< map<string,list<...> > > > How can I refer to this structure while …

Member Avatar for jencas
0
333
Member Avatar for hitchiker

[code]Excel.Application ExcelApp = new Excel.ApplicationClass(); ExcelApp.Visible = false; String WorkbookPath = filename; Excel.Workbook ExcelWorkbook = ExcelApp.Workbooks.Open(WorkbookPath, 0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true, false, false); Excel.Worksheet Sheet = (Excel.Worksheet)ExcelWorkbook.Sheets[1]; DataTable newTable = new DataTable(); string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename + ";Extended Properties= Excel …

Member Avatar for sknake
0
643
Member Avatar for csayantan
Member Avatar for umair125

i am doing bscs from GCU lahore PK.i have assigned a project name as MOVIE RENTAL STORE using OOP concepts plz help me to do my project i,ll b thankful to you, umair ahmad

Member Avatar for Ancient Dragon
-1
480
Member Avatar for ynaffit

i tried to create a program that would get the sum of the squares but i couldn't get the right output. Could u help me debug? and tell which part of my codes where wrong.PLEASE! :S [code=cplusplus] #include<iostream.h> #include<conio.h> #include<math.h> int x,num; int f(int); main () { clrscr(); cout<<"Enter a …

Member Avatar for nirav99
0
112
Member Avatar for Clawsy

Hello, I'm making an application in Visual C++ that hides/shows an application window from taskbar by clicking a button. First problem (googled it) is that I don't know how to retrieve the information about a window state (SW_HIDE,SW_SHOWNORMAL, etc.). Is it hidden, minimized, normal or maximized? I only know how …

Member Avatar for Clawsy
0
4K
Member Avatar for qkslvr1621

right now im working on a program that reads a series of numbers (doubles) from the user, then prints the mean and the range. also: • I do not know ahead of time how many numbers will be in the list. • When ctrl-z if pressed, stop asking for user …

Member Avatar for wildgoose
0
135
Member Avatar for lancevo3

Today is the first day I have attempted Operator Overloading and am running into a few errors so any assistance would be great! The first one I'm having issues with is here: const MyString& operator=(const char* rightOp) The assignment operator should also be overloaded to allow assignment of a C-style …

Member Avatar for wildgoose
0
249
Member Avatar for kramer4583

I have been working on this program for school, it does some things right but with a few things I am struggling. [QUOTE]For this assignment you will be writing a two person chip game. You will start out with a pile of 1000 chips. Each player will have the chance …

Member Avatar for kramer4583
0
188
Member Avatar for Humbaba

[code] int number; char letter; cout << "\nEnter a number\n"; cin >> number; cout << "\nEnter a letter\n"; cin >> letter; cout << "\nThanks!"; [/code] Let's say I had 5 of these questions lined up, it seems the user could just type something like "1 a 2 3 4" on …

Member Avatar for Dave Sinkula
0
89
Member Avatar for Ather14

I am trying generate even fibonacii numbers less than four million, but I keep getting negative numbers at some point and eventually it converges to a positive answer, which is obviously wrong. Can anyone please help me out? #include <conio.h> #include <stdio.h> void main (void) { clrscr(); int f1=1; int …

Member Avatar for NathanOliver
0
182
Member Avatar for mrnutty

How could one share a .exe that loads textures. I am using c++ and openGL. I want to share the .exe that I made using rapidshare.

Member Avatar for tux4life
0
85
Member Avatar for si_f

Hi All I am writing a C# windows application and it needs to run in a standard user account, however, the application should allow a standard user to create further standard user accounts using Vista\Windows 7. In order to create new accounts you need to be part of the administrator …

Member Avatar for serkan sendur
0
237
Member Avatar for daviddoria

I'm trying to start writing tests for all of my functions as per Test Driven Development. My question is, say I construct a test for "rotate vector". It would be something like this: [code] int TestRotateVector(const Vector &V) { Vector Original(1.0, 2.0); Vector Rotated = Original.Rotate(10); //rotate 10 degrees if(Rotated …

Member Avatar for StuXYZ
0
187
Member Avatar for ivanhuk

I've created a class and create two new objects from that class. 3 variables are stored as private. I have mutator and access functions for these variables. When I try to write a value through these functions, they don't seem to change the variable in the class. What am I …

Member Avatar for Lerner
0
145
Member Avatar for shopnobhumi

What could be the possible explanation of this program output? I am trying to learn c++ so please help [code]#include <iostream> using namespace std; int main( ) {int b[3][2]; cout<<sizeof(b)<<endl; cout<<sizeof(b+0)<<endl; cout<<sizeof(*(b+0))<<endl; // the next line prints 0012FF68 cout<<"The address of b is: "<<b<<endl; cout<<"The address of b+1 is: "<<b+1<<endl; …

Member Avatar for Ancient Dragon
0
174
Member Avatar for walter clark

I have a Windows program (Visual C++ CLI Type) that displays video in a sub window. When something happen the user makes a note of the event by hitting a button. The problem is that the event involves a number of choices and finding the right button to click is …

Member Avatar for walter clark
0
73
Member Avatar for teddyg18

I have a program in which i open a a text file, access it's values and create and array with it. for example the text file may contain these values: 1 44 3 4 33 6 7 8 61 10 ; that's 10 integers what c++ tools could i use …

Member Avatar for teddyg18
0
6K
Member Avatar for noamco

I have a strange bug in vs2008. ostream open fails when called in the following manner: [CODE=c++]ofstream filestr; filestr.open((filename.c_str()),ios::in|ios::out);[/CODE] when called like this it works without a hitch: [CODE=c++]ofstream filestr; filestr.open("blahblah.txt",ios::in|ios::out);[/CODE] Any ideas? Thanks

Member Avatar for noamco
0
177
Member Avatar for monkey_king

Hi I got a code that in pseudo dos something like [CODE] ifstream os; while(os.oef()){ os.getline(buffer,length); } [/CODE] If some condition is met, I'd like to be able to jump back to the previous line, such that the next getline will give the line just-read in, at a later time …

Member Avatar for tux4life
0
482
Member Avatar for mrinal.s2008

Hi, I have some questions on vector. Please consider the code below. I use g++ compiler on Linux. [CODE=c++] #include<iostream> #include<vector> using namespace std; class Sampler { int a; int b; }; int main() { vector <int> vec1; vector<float> vec2; vector<Sampler> vec3; cout << sizeof(vec1) << " " << sizeof(vec2) …

Member Avatar for jencas
0
103
Member Avatar for jaymar_jmj
Member Avatar for Ramy Mahrous
0
216
Member Avatar for Shaitan00

The age old issue of string parsing comes up again ... I have a text file that contains lines that are SUPPOSED to follow a set format, specifically: string, string, long string int string double int The delimiters are therefore: Comma (,) for the first two fields Spaces for all …

Member Avatar for jencas
0
191
Member Avatar for Shaitan00

Not sure this is going to be easy to explain but ... I have a class (A) that needs to have access to a map (mapCodes), this map is the same for all instances of class(A), therefore I don't want to create an instance of the map for each instance …

Member Avatar for jencas
0
141
Member Avatar for whotookmyname

[code] string s; cout<< "Enter name: "; cin >> s; cout<<"\n"<<s; [/code] on running this i need: Enter name: Tejesh Kinariwala Tejesh Kinariwala it is showing: Enter name: Tejesh Kinariwala Tejesh so how to get the input till user hits return key, instead of breaking it at space

Member Avatar for whotookmyname
0
80
Member Avatar for anilopo

i've wrote a code that read and write to some files, and i have a segmentation fault when i'm running it in the g++ (in the visual studio i don't have any problem like that..) anyway, i think the fault may come from this line, can anyone tell me if …

Member Avatar for anilopo
0
87
Member Avatar for Darkmorgaine

Hi i have to make this work... [code=cplusplus] //INFO: -eingabeprüfung auf buchstabe/zahl // -eingabeprüfung auf zahlenbereich // -wiederholung einbauen vill... #include <iostream> using namespace std; int main() { int eingabe; cout<<"Geben sie eine zahl ein> "; cin>>eingabe; if(eingabe>0 && eingabe<13) { switch(eingabe) { case 1: cout<<"eins"<<endl; break; case 2: cout<<"zwei"<<endl; …

Member Avatar for sotvisal
0
234
Member Avatar for lotrsimp12345

gives me error main /* The purpose of this lab is to open a text file and then make a copy of it */ #include <iostream> #include <fstream> #include "Interface.h" using namespace std; int main() { //open up file to be read from string input; ifstream in; cout<<"enter file name …

Member Avatar for lotrsimp12345
0
201
Member Avatar for mrnutty
Member Avatar for qkslvr1621

I'm trying to write a program that asks the user for a number between 1 and 10, then prints a line of that many “X"s. The program compiles, but I cannot figure out how to make the variable 'total' print X's instead of a the actual number, if that makes …

Member Avatar for qkslvr1621
0
105
Member Avatar for qkslvr1621

I need to write a program that decides if you can apply for the job or not. After asking a series of questions (all the questions) the program then needs to print out whether you can apply or not. Here are the requirments for the job • If you are …

Member Avatar for qkslvr1621
1
93
Member Avatar for Kadence

I'm having a lot of trouble finding enough RAM for a program I'm writing on Vista 64 Ultimate system, even though the system has 8GB RAM and only 2GB is used. I tried to see how many 10 million byte blocks I could allocate using malloc(), and the compiled program …

Member Avatar for jbennet
0
159
Member Avatar for ivanhuk

Help, am a c++ student who is completely stuck. I know that there are some stupid errors in this, I've been working all day on this and I still can't find them. I'm supposed to create a class, copy constructor, and than create an instance in main and then create …

Member Avatar for ivanhuk
0
191
Member Avatar for mrgreen108

I have a slight homework problem that is giving me some trouble. We have to write the algorithm for subtraction using different bases as a possibility in a program that uses calculator registers. The following is the provided prototype: bool subtractRegisters( int registerX[], int registerY[], int registerZ[], int base ); …

Member Avatar for vmanes
0
198
Member Avatar for kirennian

Hi there! With reference to the annoyance of this problem, I've spent some time searching the web as well as on here however, with few ways to extract useful threads from those less useful when typing 'RegSetValueEx int' or the like, posting was a final solution. Apologies if this type …

Member Avatar for wildgoose
0
673
Member Avatar for kspriya01

Hi, i have one doubt regarding datagridview in windows. i can take one column named "Description". I enter rows more than one for that column. but i want set the size of the column,here my requirement is 500 size for that column. pls help me, how to set the column …

Member Avatar for serkan sendur
0
90
Member Avatar for zeus1216gw

how can I use a loop to sum random numbers together? it needs to be able to sum any amount of numbers determined by the user. I can generate the random numbers but adding them is a different story. I tried to make an inner loop (if that makes sense) …

Member Avatar for zeus1216gw
0
100
Member Avatar for Samuelandjw

I often hear the saying that iostream is inefficient in terms of performance, and it is better to use printf family if type-safe is not concern. But as far as I know, the static type checking (is this thing people call the 'type-safe' do?) is done in the compilation, and …

Member Avatar for MosaicFuneral
0
1K

The End.