51,593 Topics

Member Avatar for
Member Avatar for sweety20

plz can any1 tel me hw 2 write exactly the same program as peteranswers.......in c++....

Member Avatar for sanjon
-2
93
Member Avatar for TonyMUK

This is driving me mad. This program reads 8 records from an iseries data queue and then I get the segmentation fault. I can't work out why. Does anyone have any ideas? Please!! [CODE] #define WIN32_LEAN_AND_MEAN // Include the necessary DQ Classes #include <iostream> #include <fstream> #include <windows.h> #include <cwbdq.h> …

Member Avatar for TonyMUK
0
137
Member Avatar for blackcloudbd

Can any one help me with these codes: i m freaking out here I split my program in 3 parts. 1. main - prac.cpp 2. interface - base.h 3. implementation - base.cpp in prac.cpp the code is: [CODE]#include <iostream> using namespace std; #include "base.h" int main(){ Base ob; ob.set(); ob.get(); …

Member Avatar for blackcloudbd
0
179
Member Avatar for rohan1020

Hello... I am making a program that could automatically install programs with one click, skipping the task of clicking the buttons like "Next", "I Agree", etc. I know such software are already available in the market but I want to create a customized one with my knowledge of C++. I …

0
57
Member Avatar for skorm909

Basically what I'm trying to do is simple. My main problem is the random numbers, but in the comments i have some other issues... if you know how to fix them that would be great the other two main ones im having trouble with are: the do loop until the …

Member Avatar for jonsca
0
146
Member Avatar for DynamicMember

i need a program for this function s=1+1/3+1/5+... e=0.1 i dont know the e is...but in translation it is accuracy... Show me a way...

Member Avatar for jonsca
-1
111
Member Avatar for jmcorpse

I have to write a program that creates a dynamic array of five strings, store them and be able to access them. This is the code I have written so far. The console receives the information that is inputted, but I believe does not store them. Also I commented out …

Member Avatar for jonsca
0
91
Member Avatar for User4699

I'm trying to implement a maze program by using nodes that reads in a file and the user is able to enter a direction and solve the maze. My class will not output correctly and I've been working on it for a LONG time. Any help is appreciated! I also …

Member Avatar for Greywolf333
0
679
Member Avatar for hdb25

[CODE]#include <iostream> #include <fstream> #include <sstream> #include <cstdlib> using namespace std; int dectoint (string st); int hextoint (string st); int bintoint (string st); string inttobin (int n); //string inttohex (int n); //string inttodec (int n); int main() { string st; cout<< "Enter a number in dec,hex,or binary: \n"; getline(cin,st); if …

Member Avatar for hdb25
0
173
Member Avatar for baldwindc

Could someone please explain the following code to me? It's not for class, more personal curiosity. Thanks in advance [code=cpp] while(!feof(infp)) { fgets(buf, MAXLINE, infp); fputs(buf, outfp); } [/code] what I'm mainly curious about is the argument o feof "infp."

Member Avatar for Ancient Dragon
0
146
Member Avatar for Rickay

[CODE]#include <iostream> #include <windows.h> #include <ctime> using namespace std; double time1; int main() { const double seconds1 = time(0); string string1; while(1) { long double seconds2 = time(0); if(seconds2 == seconds1 + 5) { cout << "Five seconds went by.\n\n"; break; } } cin.clear(); cin.ignore(255, '\n'); cin.get(); return 0; }[/CODE] …

Member Avatar for Rickay
0
231
Member Avatar for dlube

how would you write a for loop that calculates the total investment over 40 years if a one pays $500 each month but every 2 years the payment increases 10%?

Member Avatar for smrati.katiyar
0
102
Member Avatar for yogibear13

Hi, I have a problem where I have to create a class called Employee and calculate things such as pay etc..Part of the problem is to override the stream insertion operator, and I did, but I have a problem with the syntax of printing something out. I have a method …

Member Avatar for Greywolf333
0
288
Member Avatar for spartanace

Im having a bit of a problem with my binary search tree. For some reason my pointers arent connecting correctly. I'm pretty sure everything is correct but when i run it I keep getting this as the result. It inputs the numbers 1 5 7 9. [CODE]void insert(string word,vector<treeNode> &x) …

Member Avatar for Greywolf333
0
125
Member Avatar for Nicanor

Trying to compile a program, in my accounts.cpp I have 2 errors accounts.cpp:240: error: name lookup of `a' changed for new ISO `for' scoping accounts.cpp:234: error: using obsolete binding at `a' here's the code bool cAccount::IsOnline( int acctnum ) { if (acctnum < 0) return false; map<int, acctman_st>::iterator iter_acctman; if …

Member Avatar for frogn8r
0
831
Member Avatar for skorm909

so basically whats happening is its saying that im trying to call on the function before it appears... here's the code: [CODE]# include <iostream> # include <cmath> using namespace std ; char name [40]; // lets the players name be up to 40 characters int choice; int goblin = 250; …

Member Avatar for skorm909
0
94
Member Avatar for Hyiero

[CODE] while(temp != NULL) { if(temp->info.Name == cName) { temp->info.DiscountNumber = temp->info.DiscountNumber + 5; flag = true; } if(temp ->info.DiscountNumber > 25) { temp->info.DiscountNumber = 25; // prev->link = temp->link; // delete temp; //temp->link = first; // first = temp; } //cout<<"Discount is :" //<<temp->info.DiscountNumber //<<endl; prev = temp; temp …

Member Avatar for Hyiero
0
735
Member Avatar for rebellion346

This is a program my instructor wrote and I have to create a program that similar in format. My issue is I don't quite understand what main is doing or how it works, was hoping someone could explain it to me in detail. Rolodex.h [CODE] #ifndef _ROLODEX_H_ #define _ROLODEX_H_ #include …

Member Avatar for Shantari
0
531
Member Avatar for aznlitomik3

I need some help on the void plusEquals/minusEquals and etc function I'm not sure how to start it Please can anyone help me do the plusEquals function so I know what I'm suppose to do or maybe some guides on how to approach it Below the problem is my current …

Member Avatar for aznlitomik3
0
1K
Member Avatar for Jennifer84

Hello! I have a task where I will connect to a webpage through a proxyserver with code. The information I have is this: Site to reach: [B][url]http://www.testing.com[/url][/B] ProxyIP and port: [B]109.123.70.47:80[/B] I have googled around but cant understand what the way to do this. In some way the web proxy …

0
54
Member Avatar for yznk

[CODE] #include <iostream> #include <string> #include <vector> using namespace std; class Digraph { public: vector<bool> visited; vector<string> tasks; vector<vector<int> > precede, postcede; vector<int> order; int numtasks, num1, num2; void resetVisited(){ for(int i=0; i<visited.size(); i++){ visited[i]=false; } } bool check(vector<vector<int> > checking, int pos1) //Returns true if there is a viable …

0
81
Member Avatar for Fbody

I'm really intrigued by OOP, I feel that I can help most people with OOP questions reasonably well, but I still have a lot to learn and there's something that bothers me. What is the best way to write the program's main() if I want to create a truly OOP …

Member Avatar for Fbody
0
161
Member Avatar for Kieran Y5

Hi, Is it possible to write and compile a cross-platform C++ Program in Visual Studio (C++) Express or Professional? I only ask this question (before starting on a big project) because I would like to support other platforms without changing my coding environment, if you get what I mean. Kieran …

Member Avatar for Kieran Y5
0
190
Member Avatar for mbouster

Dear all , I need your help on this. I will say how I am thinking the solution and any help will be much aprreciated. I will denote the husbands with the following notations h1 = 11, h2=12, h3=13 and their respective wives with the numbers w1 = 21, w2 …

Member Avatar for mbouster
0
2K
Member Avatar for knellgust

[CODE]#include <iostream> #include<string> using namespace std; class Book { private: string title; double price; public: Book(); void setTitle(string s); void setPrice(double p); string getTitle() const {return title;} double getPrice() const {return price;} bool hasKeyword(string key); }; Book::Book() { title="None"; price=0; } void Book :: setTitle(string s) { title=s; } void …

Member Avatar for alaa sam
0
182
Member Avatar for nepkancha

hello all, i am new here ,, and i need some help to do this array problem.. i can't figure it out.. any help will be greatly appreciated.. here is the question: [B]1- define an array of size 100 of integers, and fill it with random numbers between 1 and …

Member Avatar for WaltP
0
119
Member Avatar for Blenor

hai just made this code and i look through it many time.. i cant figure out why it isint woking.. any suggestions ? [CODE]#include<iostream> using namespace std; int main(); { system ("TITLE calc"); system ("COLOR 5"); char cChar; double dfistnumber; double dsecondnumber; char cDoagain; do { system ("CLS"); cout << …

Member Avatar for alaa sam
0
146
Member Avatar for Hassan.shah

hi need to write a program to read or write data to PLc by rs232 using modbus protcol how can i do it Thanks in Advance

Member Avatar for daviddoria
0
137
Member Avatar for Forte1292

Hello all. I'm creating a checkers program using C++. My board and pieces all display fine and everything works smoothly after pieces move and jump. The only problem is that after 12 successful moves it cuts off every time and I can briefly read something like BGI graphics error or …

Member Avatar for Mehwish Iqbal
0
162
Member Avatar for sadsdw

Hi friends, I'm having problems to use 2 consecutive "cin.get()". The second get() is not been accessed. But if debug I can answer the name of second file. Can you help me? Cheers, Sads [CODE]cout << "\nEnter the name of the first FILE : " << endl; cin.get (FileName1,256); cout …

Member Avatar for sadsdw
0
98
Member Avatar for Mr_PoP

hi there [CODE] #include "stdafx.h" #include <iostream> #include <mysql.h> int _tmain(int argc, _TCHAR* argv[]) { MYSQL *con; mysql_real_connect(con, "localhost", "alakazam","username","password",0,NULL,0); } [/CODE] Error IntelliSense: identifier "SOCKET" is undefined in file mysql_com.h how should i fix it?!!

Member Avatar for daviddoria
0
75
Member Avatar for skorm909

So i haven't been coding in awhile and i just decided to try and make a game again. nothing fancy just a simple text rpg. here's my code so far there's a few errors and if you know how to fix them that would be great... also i have some …

Member Avatar for alexchen
0
94
Member Avatar for rain.divine88

Hi all, I need a help from you. I'm writing a c++ console program that only accept only positive number. If the user enter an invalid number like negative and string, I want to display like [CODE]cout << "Enter a number";[/CODE] I want to loop this message until user enter …

Member Avatar for Shankye
0
160
Member Avatar for sadsdw

Hi friends, I'm newer in C++ and I'm trying write a code using ifstream, vector and substr. A) I have 2 problems: A.1) When I read files with small number of lines OK, but if I increase the number of lines, PROBLEM. As example: file1.txt (Work well with 9 lines, …

Member Avatar for daviddoria
0
199
Member Avatar for GURU1349

I'm a beginner in C++. I'm not studying it so I don't have a teacher and I don't have a book, a guide. The Internet is my only guide. Well here's my program: [CODE]#include <iostream> #include <math.h> using namespace std; int main () { int q; float x,y; Baslangic: cout …

Member Avatar for GURU1349
0
127
Member Avatar for Hey11

hello , i used an array using aggregration in OOP in order to insert multiple datatypes in the array and i wanted to convert it into dynamic array , so as to edit the entries and here is the code of the 2 classes and the main function [CODE]#include<iostream> #include<string> …

Member Avatar for daviddoria
0
224
Member Avatar for tech9x

i want my data can be used over every function, so i need a class to capture them, am i correct?? here is my outline, im not sure if i use it correctly, please help!! [code=c++] class CLASS { private: int * (something) string * (something) public: void (function) () …

Member Avatar for Greywolf333
0
250
Member Avatar for dudman

[CODE]#ifndef _EMPLOYEE_H #define _EMPLOYEE_H #define _ProductionWorker_h #pragma warning(disable: 4996) #include <cstring> #include <iostream> #include <cstdlib> using namespace std; //const int SIZE = 40; // Array Size class Employee //Definition of Employee Class { private: //char employName[SIZE]; char *employName; int employNum; int hireDate; public: Employee(); //Constructor Employee(char *e) {employName = new …

Member Avatar for dudman
0
155
Member Avatar for Raja Paul

Hi, I want to make a tree view control which can display the file lists in my machine's hard disk. I want to do this using C/C++/VC++. Someone can help me out please regarding this matter.....

Member Avatar for jonsca
0
104
Member Avatar for blackrandom

Okay so I have been debugging for hours and I don't understand any of this...I'm kinda mad about not knowing and when I research it all I find how it works but not really how to implement it. I know the general theory of a binary search tree but I'm …

Member Avatar for blackrandom
0
152
Member Avatar for knellgust

[CODE]#include <iostream> #include<string> using namespace std; class Book { private: string title; double price; public: Book(); void setTitle(string s); void setPrice(double p); string getTitle() const {return title;} double getPrice() const {return price;} bool hasKeyword(string key); }; Book::Book() { title="None"; price=0; } void Book :: setTitle(string s) { title=s; } void …

Member Avatar for knellgust
0
102
Member Avatar for nickx522

i need help writing display of average function. i find the average in first function "int Main()". it needs to be rounded to 2 decimal points. int display_avg( //dont know what parameters should be)

Member Avatar for Akill10
0
96
Member Avatar for dinners

[CODE] bool isSame=false; do { bool isSame=false; for (int i=1; i<=corners; i++) { cout << "Please enter the cordinates for corner " << i << ':'; cin >> x[(i-1)] >> y[(i-1)]; } int k; for (k=0;k<(corners-1);k++) { int j; for(j=(k+1);j<corners;j++) { if ((x[k]==x[j])&&(y[k]==y[j])) { isSame=true; } } } if (isSame==true) …

Member Avatar for dinners
0
302
Member Avatar for knnccb

i just got an exercise i am asked to do and i have no idea what to do. I am asked to use recursive to print a pattern without using loop: * ** *** **** **** *** ** * And also : **** *** ** * ** *** **** Any …

Member Avatar for knnccb
0
117
Member Avatar for djhog

#include <iostream> #include <fstream> #include <string> #include <iomanip> using namespace std; int main () { int Count= 0, oldCount, lineNo= 0, pos; string searchStr, testStr, testSearch, fileName, intStr; cout << "File name? "; getline(cin,fileName); ifstream fin(fileName.c_str());; if (!fin) { perror(fileName.c_str()); exit(1); } cout<<"Search string? "; getline (cin, searchStr); testSearch = …

Member Avatar for jonsca
0
171
Member Avatar for ScreamingPsycho

Hello, first time here.This program reads in a file of different names and uses void options to put them in various order. On line 111, 116, 121, 126, 131, I am not sure what to put inside the parenthesis. [EX: option1(NotSureWhatToPut)]. I have tried to put 'nextStudent' and get a …

Member Avatar for ScreamingPsycho
0
201
Member Avatar for jmcorpse

[CODE] #include<iostream> #include<cstddef> using namespace std; typedef int* IntArrayPtr; void getSize(int& size1, int& size2);//Function declaration for getSize void createArrays(int& size1, int& size2);//Function declaration for createArrays void fillArrays(int& size1, int& size2);//Function declaration for fillArrays int main() { int size1;//Variable that will be passed from one function to another int size2;//Variable that …

Member Avatar for jonsca
0
212
Member Avatar for shotbylammi

I am currently in a C++ class. We have using Python and my assignment is to do a lab that I have done in python 2.5 in C++, although I have no idea where to begin besides opening Dev C++ or Bloodshed. Could anyone please tell me how I begin …

Member Avatar for Fbody
0
171
Member Avatar for Nandomo

I am in need of an explanation on how to pass information from my input file to my program. This is what I'm trying: [CODE]#include <cstdlib> #include <iostream> #include <fstream> #include <string> using namespace std; struct BevInfo { char bevName[11]; float bevPrice; int bevLeft; }; int main(int argc, char *argv[]) …

Member Avatar for Clinton Portis
0
111
Member Avatar for jmcorpse

How can I go about padding an array of a certain size so that it will align with another one? For example I have an addition problem I am working out and cannot find the solution to. When my program prints it out it will look like this: 1234567 should …

Member Avatar for Clinton Portis
0
2K

The End.