49,755 Topics

Member Avatar for
Member Avatar for dougy83

Hi. I have written a small test socket program that uses a background thread that accepts tcp connections and adds them to a connection list that is accessed by main(). When a connection is opened, then later closed, recv() is called (see line highlighted in code below), which throws an …

Member Avatar for dougy83
0
228
Member Avatar for koman

[code=cplusplus] int main() { string name; cout << "Please enter the filename of the encoded message:"; getline(cin,name); ifstream infile; infile.open(name.c_str()); if (infile.fail()) { cout << name << " fail to open." << endl; exit(1); } cout << name << endl; cout << " File successfully opened" << endl; string buffer; …

Member Avatar for VernonDozier
0
148
Member Avatar for Jaqky
Member Avatar for risa

hi, I get a crash as "Unhandled exception at 0x5f4335bb (MFC42D.DLL) in VMFirewall.exe: 0xC0000005: Access violation reading location 0x00000000." in D:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\src\mfc\appmodul.cpp in _tWinMain() funtion at call of AfxWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow); This crash is in both debug and release....i have tried ignore of mfc42D.lib and mfcs42d.lib....but …

Member Avatar for risa
0
394
Member Avatar for clutchkiller

My dev-c++ compiler is telling me that ios::noreplace is not a valid member of std::ios. Why?

Member Avatar for clutchkiller
0
91
Member Avatar for skatamatic

Well, this is for the same assignment as my last post. It's just a simple implementation of a bunch of Algorithm functions. It throws a runtime exception at the end saying the stack around the b variable was corrupted! I commented out all the lines with that use the b …

Member Avatar for skatamatic
0
134
Member Avatar for skatamatic

I'm working on an assignment for school where my teacher wants me to convert each member of an array of a class if it's int member is greater than 300. I can make it work for the first value of 300, since that's what find_if returns. But how do I …

Member Avatar for skatamatic
0
187
Member Avatar for monere

Hello, I am really new in the C++ environment. As part of a video project i want to compare a master binary mpeg4 file whose size is about 20 meg bytes size to numerous video ( ex up to 30) mpeg4 clips of appproximately 1 meg each. My aim is …

0
57
Member Avatar for kevintse

int& fun(){ int a = 10; cout << &a << endl; return a; } int main() { int& r = fun(); cout << r << endl; cout << &r << endl; return 0; } outputs of the code above are: 0xbf8567b4 10 0xbf8567b4 and when i change `int& r = …

Member Avatar for kevintse
0
69
Member Avatar for altrim

hi everyone i am new to C++ need help; //Write a program that for 5 books with this atributes //books name //authors name //publishing year //book price to be selected only the books from the same year typed by the user(using structures) |

Member Avatar for VernonDozier
0
128
Member Avatar for darren2005

Can anyone let me know how I could include a variable within a system command? (This is a win32 project and not an application.) I am using: (some code taken out) [ICODE] system(("set path=%path%;"[COLOR="Red"]+user[/COLOR]).c_str()); system(("set CLASSPATH=.;"[COLOR="Red"]+usertwo[/COLOR]).c_str()); system(("java -Djava.security.manager -Djava.security.policy="[COLOR="Red"]+user+[/COLOR]"\examplepolicy Xsys").c_str());[/ICODE] Thanks in advance!!!

Member Avatar for darren2005
0
565
Member Avatar for JustLearning

I am having a problem writing the last part of my code for this program. There is a DFS function that I need to write that is included in the header file of the graph.h my program. Here is the sample of code that my instructor gave me. [code=c++]template<class VertexType> …

Member Avatar for JustLearning
0
173
Member Avatar for bf2loser

I'm getting an unresolved symbols linking error with this code, the cpp files compile successfully separately, I just can't build the solution and run it. any ideas? header.h [code=c++] #include <iostream> #include <string> using std::string; using namespace std; class Double { private: double dub; char str[50]; public: Double(); Double(char s[50]); …

Member Avatar for bf2loser
0
201
Member Avatar for minas1

[code=C++] int MAX_NUM = 600851475143; int max = 0; vector <int> ints; for(int i = 1; i <= MAX_NUM; ++i) if((int)MAX_NUM % i == 0) ints.push_back(i); cout << "size = " << ints.size(); [/code] I get 0. Something is wrong. I get 2 warnings: warning C4305: 'initializing' : truncation from …

Member Avatar for Alex Edwards
0
121
Member Avatar for dblbac

i was given this question by my instructor and i am completely in the dark on what to do. i have been trying to figure out what to do but couldn't find anything in the book that really explained it. any help with this would be greatly appreciated. explain what …

Member Avatar for minas1
0
139
Member Avatar for Marauder

Don't know what is wrong with this, it's giving me an error on the 'if (isalpha(string[i]))' line..I had it working earlier but then decided to put it into a function and it's not working now. It's giving the error "expected primary-expression before '[' token " for that line and the …

Member Avatar for Narue
0
106
Member Avatar for christiangirl

Hello, I'm having trouble with this program. What I have to do is open a file(in this case link.dat) and then the user chooses what they want to do, take something out of it, add somethng to it, print it. It opens the file fine, but then I cant get …

Member Avatar for christiangirl
0
91
Member Avatar for elsa87

please help me write a function which will return the last element in an unsorted list. the prototype of the function should be ItemType ReturnLastItem(); we should assume that the list is not empty ans it shouldnt change after the program is executed.. pleeeeeeeeease help me

Member Avatar for Narue
0
141
Member Avatar for andrewama

Hey guys i was just wondering i have a code that will allow you to output times 4 different ways but instead of times i want it to output dates 4 different ways. [code=C++] #include <iostream> using std::cout; #include <iomanip> using std::setfill; using std::setw; using std::endl; #include "Time.h" // include …

Member Avatar for Lerner
0
91
Member Avatar for Behi Jon

Hi . I want a program that receive a number and print its subcollections . like this : n=3 : cout : {} , {A} , {B} , {C} , {A,B} , {A,C} , {B,C} , {A,B,C} (with one of the A,B,C , ... characters .) Please help me . …

Member Avatar for Lerner
0
87
Member Avatar for davids2004

I am trying to write a program that can be used to display two random numbers to be added together. This program should wait for the answer to be input. If the answer is correct display a statement that says that is correct. If the answer is wrong it needs …

Member Avatar for davids2004
0
400
Member Avatar for SQ89

Create a class called Employee that includes three pieces of information as data members – a first name (type string), a last name (type string) and a monthly salary (type int). Your class should have a constructor that initializes the three data members. Provide a set and a get function …

Member Avatar for SQ89
0
545
Member Avatar for DragonReborn225

hey guys, I've seemingly exhausted all the possibilities within my limited knowledge, so I'm coming here for some assistance. heres the problem: Read the 20 students info into an array, assign the relevant grade, find the highest score, and print out all the names/scores in addition to the student/s of …

Member Avatar for Lerner
0
167
Member Avatar for Foe89

Here's the problem, questions at the bottom. Write a program that uses a structure named MovieData to store the following information about a movie: Title Director Year Released Running time (in minutes) Include a constructor that allows all 4 of these member data values to be specified at the time …

Member Avatar for Lerner
0
157
Member Avatar for gammavn

I meets some problem with downcast in c++ programming language. Thus, I needs your help. My program has 5 classes. They are Employee (abstract class),Salary:public Employee,Hourly:public Employee,Commission:public Employee and BasePlusCom:public Commission. In main() function,I used vector<Employee*>employees[4]; Then I assigned values to employees. ........ And I used structural syntax BasePlusCom* ComPtr=dynamic_cast<BasePlusCom*>(employees[i]); …

Member Avatar for vijayan121
0
184
Member Avatar for number87

ok basically what my program is about. I am to create a program that allows users to input aircraft/cargo details, add the cargo to the aircraft(up to 20), and a function to display all the cargo on that aircraft. So the main problem i am getting is with the listing …

Member Avatar for minas1
0
120
Member Avatar for insertnamehere8

Hi. This is for a phonebook assignment. Part of the assignment involves searching a 2D array. This is the function that reads the phonebook file. [code] void getData(char name[][NAMESIZE], char telephone[][PHONESIZE], char zipcode[][ZIPSIZE], char address[][ADDSIZE], int& size); ~~~~~ void getData(char name[][NAMESIZE], char telephone[][PHONESIZE], char zipcode[][ZIPSIZE], char address[][ADDSIZE], int& size){ int …

Member Avatar for insertnamehere8
0
216
Member Avatar for Stefano Mtangoo

Hello all, greetings! I'm python guy and I want to access Lame encoder from python. The big problem is I cannot find suitable lame bindings. After loooong googling and metacrawling, I found py-lame. The problem is, when I try to compile it in codeblocks, python.h is missing. I don't know …

Member Avatar for Nick Evan
0
94
Member Avatar for midimatt

Hello everybody, I'm back, started my 2nd year at Uni now and started programming in the wonder that is C++ and enjoying it tremendously. but I've hit a slight problem, not with code but with design. I'm not sure where to put the input/output, sounds weird but I'll elaborate. i …

Member Avatar for ithelp
0
140
Member Avatar for PaladinHammer

Here is the code: [CODE]// All this has to do is take the "names.txt" file, and send it to "backwards.txt" // in reverse order, as an array. No idea why its not working, sent all necessary files with it. #include <iostream> #include <fstream> #include <iomanip> #include <string> #include <ctime> using …

Member Avatar for PaladinHammer
0
226

The End.