49,757 Topics

Member Avatar for
Member Avatar for anuran

iam trying to optimize a code i want to run code for arm_no=1000, its running for 100 arms but further increasing causes segmentation fault core dumped. to run the code use $ g++ Epsilon_greed.cpp -lm `gsl-config --libs` $ ./a.out but you'll have to install libgsl0 i.e gnu scientific library. #include<stdio.h> …

Member Avatar for anuran
0
467
Member Avatar for abhinav.gokooloopadhya.5
Member Avatar for pooja.singh.3950

is this is the correct way 2 write destructor of copy constructor and parameterised constructor ~a(int x,float y) ~a(a &a1)

Member Avatar for nchy13
0
243
Member Avatar for suryavanshianki

**I am new in Visual C++ 2008. here is a project which is alredy developed and this time under maintence. In this project there are 5 projects which one one project is depend on another example a,b,c,d,e are 5 projects and b depends on a,c depends on b i.e --a-->b-->c-->d-->e. …

Member Avatar for deceptikon
0
306
Member Avatar for devourer17

fstream f; char ch; int i=0; string word,word2[200]; f.open("op3_sort.txt",ios::in|ios::out); if(!f) cout<<"\nUnable To Open File!\n"; else { cout<<"\nLet's View D Content!\n"; while(!f.eof()) { getline(f,word,'\t'); word2[i]=word; i++; cout<<word2[i]; } } cout<<"\nShowing Data Now\n"; for(int a=0; a<i; a++) { cout<<endl; cout<<word2[a]; }

Member Avatar for devourer17
-1
150
Member Avatar for manel1989

Hi everyone! I would like to know how to create a xml file and display it in a fixed location other than the console, I have successfuly create and display it in the console, what I want is to display in the following location C: \ Users \ abdelhalim \ …

Member Avatar for manel1989
0
285
Member Avatar for manel1989

hi! i want to concatenate a string with an integer that's why i used this code : ++k; char f[50]; sprintf(f,"%d",k); strcat ( f,"N"); but what i got is this ( for example :**1N**) and what i want is some thing like this : **N1** Could you please help me …

Member Avatar for Ketsuekiame
0
210
Member Avatar for kal_crazy

I can not get a sum from a function and return to main to check whether the sum is greater than the money added in and input more money. int vending::MakeSelection(int ItemPrice[], int NumItems[], int sum){ int response; do{ cout << "Item:"; cin >> response; if(response == 1){ for(int i …

Member Avatar for kal_crazy
0
444
Member Avatar for nmakes

I've got a problem understanding inheritance. #include <iostream.h> class A { public: int x; }; class S1: public A { public: int x; }; class S2: public S1 { public: int x; }; int main() { S2 obj; cout << obj.x; return 0; } In the code above, I basically …

Member Avatar for Ancient Dragon
0
225
Member Avatar for erinkay528

Here is my assignment. I would like someone to walk thru some of this with me if you have time today. This is my last assignment and I just dont understand parallel arrays and how to recall information. If someone could help me get started that would be a big …

Member Avatar for Ketsuekiame
0
505
Member Avatar for nmakes

I am getting garbage values for this program.. Please help. /* =============== == Program 8 == =============== Q. Write a program to enter and print student's details (Personal, Academics and Skills) using multiple inheritance */ #include <iostream.h> #include <string.h> #include <stdio.h> #include <conio.h> class skills { public: char hobby[]; char …

Member Avatar for nmakes
0
246
Member Avatar for devourer17

I've a text file : Random.txt which comprises of Jade 12MS234 Male 18 Rocky 12MS324 Male 18 Marx 12MS632 Male 18 Now in my program i've a class class stud ( char name[10] char reg[10] char gender[10] int age ) Now I've to write a code in c++, where i've …

Member Avatar for Moschops
0
458
Member Avatar for titas.datta

Hi! I have written a code to subtract 2 large integers stored in arrays! But the problem is, its not working when the minuend is smaller than the subtrahend, i.e, when the answer would be negative. I am taking 2 char arrays as parameters, converting them to int arrays, working …

Member Avatar for Ketsuekiame
0
393
Member Avatar for Prem_1

How to compute current ratio in C++ with using header file? Calculate in c++ program with *3* different file. **- 2 file (cpp file) - 1 file (header file)** Information: formula---> **Current ratio = current asset / current liabilities** Please correct me If I'm wrong. I just start study C++ …

Member Avatar for deceptikon
0
661
Member Avatar for christinetom

Hi everyone.. :), me again. I've never used Linked Lists.. They don't make sense to me. I kind of understand them though. There's plently of online explanations explaining what they are but they all go down the same path. I'm trying to undertstand how one Note (via the next pointer) …

Member Avatar for christinetom
0
273
Member Avatar for phorce

I'm attempting to implement the Factory Pattern. I have a class called "Window" which has a class member function which determines which object is being called and then assigns the particular object pointer. I have written the following code: class Hamming { public: Hamming() { } Hamming(int theSize) { // …

Member Avatar for deceptikon
0
187
Member Avatar for David W

Because things, these days, seem a little 'slow' around this forum, please forebare this old post, (that was recently resurrected by an inquiring mind), and humour this 'update', in good faith that this update might be appreciated by some beginning students of C++ ... :) // beginnerBadCppExampleCodeBeforeFixedUp.cpp // 2013-08-14 // …

Member Avatar for deceptikon
0
450
Member Avatar for JameB

Hi guys, I'm working on a side project for a friend and I'm looking for a C++ library that allows me to put bunch of paragraphs in a PDF format. Anyone know any good libraries that can do this as simply as possible? It will be just paragraphs and paragraphs …

Member Avatar for iamthwee
0
764
Member Avatar for leonidas007

i've being trying to fix the error in my code for quite some time but am unable to resolve one or two of the errors like expected primary-expression before 'public' main.cpp:211:22: error: expected ';' before 'public' main.cpp:216:23: error: expected '}' before 'else' i am a beginner in programming # include<iostream> …

Member Avatar for mike_2000_17
0
149
Member Avatar for Jordancrack
Member Avatar for cedwards

Hi Im trying to create a random 2D array (3 x 3) so that numbers 1-9 will randomly be placed in the grid behind the '?' shown in coveredarray but in the guessarray just wanted to know if im doing right, im faily new to C++, also i wanted how …

Member Avatar for vijayan121
0
280
Member Avatar for Rahul47

This simple program of pointer generating THREAT Warning and identified as MALWARE. I dont see HOW ? #include<stdio.h> #include<conio.h> #include<iostream.h> int main() { int num; int *ptr; ptr=&num; cout<<ptr; cout<<ptr++; cout<<ptr; cout<<sizeof(num); getch(); } ![3283bd99afe1c651a274377d4deb3f45](/attachments/large/4/3283bd99afe1c651a274377d4deb3f45.jpg "3283bd99afe1c651a274377d4deb3f45") Thanx.

Member Avatar for Rahul47
0
308
Member Avatar for phorce

Sorry if this is hard to understand what I'm trying to do here, but, I do not know how to approach this. I am using method overloading in my constructors of a class, and I have multiple "Window" functions which are all classes that can be used and I need …

Member Avatar for mike_2000_17
0
292
Member Avatar for cedwards

Hi Im trying to create a random 2D array (3 x 3) so that numbers 1-9 will randomly be placed in the grid behind the '?' shown in coveredarray but in the guessarray just wanted to know if im doing right, im faily new to C++, also i wanted to …

Member Avatar for cedwards
0
193
Member Avatar for max2011

hi. i am marsh a student guys i have a activity but i don't know to start it with a loop. can you help me? ***** ***** **** **** *** *** ** ** * * ** ** *** *** **** **** ***** *****

Member Avatar for Gonbe
0
191
Member Avatar for sireiz

I am facing a logical error in the function filewrite() but i cant figure it out, it all seems right. The sum of the array elements is shown on the screen but when it is written in the file, it is not in the correct format. #include<iostream> #include<cstdlib> #include<fstream> using …

Member Avatar for David W
0
217
Member Avatar for charles.dupree.37

Hi I was wondering if someone could tell me what I am doing wrong. I am trying to call the age function from the person class within the PEmployee class. but the name does not display and the age states 0. thank you for any insight you may give me. …

Member Avatar for David W
0
654
Member Avatar for ddm

1. Write the definitions of the following methods for the class doublyLinkedList a. copyList b. copy constructor c. function to overload the assignment operator d. destructor Also, write a program to test the copy constructor and the assignment operator methods of the class doublyLinkedList. #ifndef H_doublyLinkedList #define H_doublyLinkedList #include <iostream> …

Member Avatar for David W
0
577
Member Avatar for MasterHacker110

I read somewhere that when you develop a kernel in c++, that the new, delete and static_cast keywords require timing references... I was unable to find the site again but my question is, why does these keywords require timing references?

Member Avatar for MasterHacker110
0
210
Member Avatar for triumphost

I want to use it because it says it supports all the C++11 features and I'm hoping that includes Regex as well since gcc isn't near finishing anytime soon.. However, many other websites are saying that clang requires Mingw/gcc to be used in the first place. It doesn't make any …

Member Avatar for triumphost
0
695

The End.