49,761 Topics

Member Avatar for
Member Avatar for vbx_wx

I have a sockets projects using tcp/ip and it is structured like this: [code] class Socket { int desc; Socket(); // create socket here }: class TCPSocket: public Socket { public: int send(); int recv(); }; class ClientSocket: public TCPSocket { public: void connect(); }; class ServerSocket: public Socket { …

Member Avatar for vbx_wx
0
165
Member Avatar for mitrious

In the book I'm studying we are given a function to make rand() work for numbers that are smaller that RAND_MAX [CODE] int nrand(int n){ if(n <= 0 || n > RAND_MAX) throw domain_error("Argument to nrand is out-of-range"); const int bucket_size = RAND_MAX/n; int r; do r = rand()/bucket_size; while(r …

Member Avatar for pseudorandom21
0
1K
Member Avatar for themadhatterxxx

I have a program that I've written...basically the problem starts when I reach the condition to hit the following block: [CODE] status = myPubSubSubscribe.Receive(fsReceivedTopic, myBufferSubscribe, myHeader, 0); if (status == PS_ENGINE_UNAVAIL) { printf("Unable to connect to the pubsub engine: %s\n", PSPubSub::Status2String(status)); myBufferPublish.FreeBuffer(); myBufferPublish.~PSBuffer(); myPubSubPublish.~PSPubSub(); myBufferSubscribe.~PSBuffer(); myPubSubSubscribe.~PSPubSub(); return; } [/CODE] In …

0
86
Member Avatar for beejay321

[CODE]// ---------------------------------------------- // Name: William Rennie // Program: // Description: // ---------------------------------------------- #include <iostream> #include <cstdlib> #include <stdio.h> #include <string.h> using namespace std; // ----------- Function definitions ------------- void printTitle(int gamenumber){ gamenumber++; cout<<"***Word guessing game round "<<gamenumber;} bool checkWord(char word[],char guess[]){ int i; int x=strcmp(word,guess); if (x==0){return true;} else return …

Member Avatar for Moschops
0
218
Member Avatar for bleedsgreen33

Working with large int numbers. Broken up as char for each digit, total of 3 arrays, n1, n2, and sum. I have everything completed, the math works fine, the arrays work fine, the shuffling to the right side of the array works fine. I just have two issues, that both …

Member Avatar for bleedsgreen33
0
191
Member Avatar for Duki

I need to generate a core file for a crashing process and then read it using dbx - can anyone help me with this?

Member Avatar for nezachem
0
104
Member Avatar for livinFuture

I'm reading about two-dimensional and multi-dimensional arrays at the moment in order to better organize user input. I'm trying to create a function that can store a card player's hand. At the moment I'm just brainstorming how it would look and writing out some notes to myself to organize it …

Member Avatar for caut_baia
0
273
Member Avatar for Lord_Migit

Hey folks, just a quick question i can't seem to find the answer to. If i overwrite a container with a pointer in it, does the pointer and therefore the object it points to still exist, and would that be considered a bad handling of memory. For instance. I have …

Member Avatar for Lord_Migit
0
140
Member Avatar for Behi Jon

Hi, Why I get access violation in this code ? [code] char *arr[ 5 ]; for( int i = 0; i < 5; i++ ) cin >> arr[ i ]; [/code] but not in this : [code] char *arr[ 5 ]; char list[ 5 ][ 30 ]; for( int i …

Member Avatar for Narue
0
99
Member Avatar for lilsean67

Okay here is go this is my first time posting to this website and I hope I can get this all right for you all. I have stated this program and I gt know errors but the program will not run past my first cin cout statements? Does anyone see …

Member Avatar for lilsean67
0
114
Member Avatar for elsiekins

Hello Using : [CODE] cout << "enter 5 letter"; getline(cin, letter); [/CODE] executes fine but when running PC- Lint: getline(cin, expectedLabel): error 534: (Warning -- Ignoring return value of function 'std::getline(std::basic_istream<char,std::char_traits<char>> &, std::basic_string<char,std::char_traits<char>,std::allocator<char>> &)' error 830: (Info -- Location cited in prior message) I was wondering if anyone could tell …

Member Avatar for Narue
0
255
Member Avatar for Arbus

Hello friends, I am having a trouble with dosbox 0.72. I opened turbo c++ using dosbox and tried a program. But it throws an error 'unable to create hello.obj'. my program [CODE]#include<iostream.h> #include<conio.h> void main() { cout<<"hello"; }[/CODE] I gave this while opening turbo c++ in dosbox... Z:\>mount c d:\turboc3\ …

0
60
Member Avatar for Annettest
Member Avatar for alex55

I have a program which i need to run with 2 input files 1 is no problem but i have no idea where to start with having it run with 2 anyone have any ideas? basically heres how it goes 1)have the program run with data01.dat 2)outputs results to output.dat …

Member Avatar for alex55
0
213
Member Avatar for bdkminang

How to write this problem.. a. Show the customer the different breakfast items offered by the HIFI's restaurant. b. Allow the customer to select more than one item from menu c. Calculate and print the bill to the customer Plain Egg $2.50 Bacon and Egg $3.45 Muffin $2.20 French Toast …

Member Avatar for bdkminang
0
810
Member Avatar for plang007

I need a lot of help with this program: I know this is a homework problem but I am really struggling with it. This program requires you to input information about rickshaw taxi fares. The ODUSPORTS is a student powered on-campus rickshaw transportation system. Upon departure, a ticket is created …

Member Avatar for ravenous
0
718
Member Avatar for jasleen12345

[CODE] #include<iostream> #include<fstream> #include<string> using namespace std; int main() { cout<<"Start entering your text\n Put a * to terminate\n"; ofstream fout; fout.open("1818.txt"); int i=0; char c; while((c=getchar())!='*') { fout<<c; } fout.close(); ifstream fin; fin.open("1818.txt"); int word=1; int line=0; int vowels=0; while(fin) { fin.get(c); if(c==' ') word++; else if(c=='\n') line++; else …

Member Avatar for ravenous
0
637
Member Avatar for format_c

error C2784: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ifstream' 1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\string(527) : see declaration of 'std::getline' [CODE]void read() { Inventory items[100]; string line; int i=0; ifstream inventdata; inventdata.open("Inventory.dat", ios::in); if( !inventdata ) { cout << "ERROR: Unable to …

Member Avatar for Fbody
0
477
Member Avatar for jonspeidel

so cplusplus.com is losing my connection and won't email back yada yada, so untill thats resolved I'm transferring my learning to this site, now for the program. any way its just a simple "choose the math operation program" then it performs that operation, but I wanted to add a part …

Member Avatar for 1ML
0
520
Member Avatar for teppel

Hi all, I kind of new in C++ and my assignment require me to do some encryption on data. Found the AES file online can anyhow guide me how to use it ? Because when i compile the test.cpp it keep giving me exception not match error. And btw how …

Member Avatar for pseudorandom21
0
510
Member Avatar for bensewards

The question is: A file contains a list of names in the form: Jones, Frederick M Brennan, Claire Your program should alphabetize the list. Use the C++ string class. Also, extract names from the input stream with getline(). What i know so far: main() should declare a char array and …

Member Avatar for ravenous
0
200
Member Avatar for Akill10

Hi, I am writing this template Array class. I am trying out some different functions, anything I can think of to implement. I have written an Add function as follows: [CODE] /**Add function - adds an element at the top of the stack**/ //creates new Array 1 larger //sets position …

Member Avatar for Akill10
0
220
Member Avatar for Hawkpath

I'm a beginner c++ programmer. I use Win XP and CodeBlocks. I'm trying to make a pong game, I already have the controls programmed, but I need a method to do the following: Check for user input, if they don't input for x milliseconds, then continue with the loop so …

Member Avatar for katmai539
0
197
Member Avatar for whodoes21

ok so what does this do.. 1.) read the text file(most likely a c++ code in text form) line by line and display it line by line... 2.) (as the title says) check for syntax errors. ( only minor ones like missing ";" or a lack of closing braces) soooo..... …

Member Avatar for ravenous
0
2K
Member Avatar for goody11

I am currently working on a Win32 program where I have a picture. Depending where they click on the picture, something will happen.I just loaded the picture on the window, but how do I make it so that my program can tell when a certain area on the picture on …

Member Avatar for Ancient Dragon
0
91
Member Avatar for lochnessmonster

im curious as to if there is a benefit to the coder and/or reader in assigning a variable name in a class functions prototype...for example class book { private: //blah public: book( int, string, double); } vs. class book { private: //blah public: book( int data1, string name1, double data2); …

Member Avatar for vijayan121
0
69
Member Avatar for SeePlusPlus2

I'm trying to read this input from a text file but whenever I try to output it, it shows up as 00000. Input: IBM 100 93.2 98.6 MER 200 67.2 43.89 QQQ 300 78.9 70.0 C 200 35.78 50.02 CSCO 400 45.67 57.23 This is what I have so far: …

Member Avatar for SeePlusPlus2
0
206
Member Avatar for coolbeanbob
Member Avatar for kra9853

The program asks the user to provide from 1 to 6, inclusive, numbers between 1 and 59, inclusive, as their lotto numbers. The lotto program will then use the random number generator to provide the same number of numbers in the same range. Check to see how many of the …

Member Avatar for kra9853
0
580
Member Avatar for xXProgrammerXx

I am working on a program that will scan the screen for a certain color. I made a code that will scan, but it is too slow. Is there anything else i can use instead of GetPixel()? Or is any other way I can speed this up. If it helps …

Member Avatar for pseudorandom21
0
88

The End.