51,593 Topics

Member Avatar for
Member Avatar for so0lid

Hi everybody, I am trying to make the real substr function in c++ which its a member of String Class. Here what I have done: [code]void substr(char x[], int n, int n2){ char *p; p = x; for(int i=0; i<=n2; i++) *(p+i) = *(p+i+n); *(p+n2) = '\0'; // I can …

Member Avatar for mrnutty
0
98
Member Avatar for rowley4

I need to write a program that implements the reverse function using a recursive solution by removing the first character, reversing a sentence consisting of the remaining text, and combining the two. I have written this code below. I have two problems. 1, I am getting a fatal error on …

Member Avatar for rowley4
0
330
Member Avatar for digital_dizasta

Question 1 Package-delivery services, such as FedEx®, DHL® and UPS®, offer a number of different shipping options, each with specific costs associated. Create an inheritance hierarchy to represent various types of packages. Use Package as the base class of the hierarchy, then include classes TwoDayPackage and OvernightPackage that derive from …

Member Avatar for mrniceguy03
0
3K
Member Avatar for RStartin

Hi everyone, I just started doing C++ coming from a java background. I'm writing a discrete event simulator at the moment and need to put 'job' objects into a priority queue and sort them by their next job time- i.e. shortest job time first. I first tried doing the following: …

Member Avatar for RStartin
0
386
Member Avatar for epicasian

When I try to compile my project, I get 138 errors about the include files in VC++ 2008: [url]http://pastebin.com/yfp85sMF[/url] Thanks in advance, ~Asian

Member Avatar for mike_2000_17
0
165
Member Avatar for aukeebler

Error 1 error LNK2019: unresolved external symbol "void __cdecl calcCelsius(double)" (?calcCelsius@@YAXN@Z) referenced in function _main

Member Avatar for aukeebler
0
79
Member Avatar for old_jefrey

Let’s say you have few functions: func_1(arg1, arg2, arg3) , func_2 (arg1, arg2) and func_3 (arg1, arg2, arg3). All 3 performing similar steps: func (arg1, arg2, arg3) { Read line from the file validate_func() Store results into arg3 } So my question is – what would best way to approach …

Member Avatar for mike_2000_17
0
141
Member Avatar for superjacent

I'm self studying from the book, C++ Primer Plus Fifth Edition, by Stephen Prata. The following relates to Chapter 13, Page 699, Programming Exercise #4. One task is to write the derived class method definitions based upon the given prototypes. The following are the said prototypes. [CODE="cpp"]class Port { private: …

Member Avatar for sheldonrobinson
1
59K
Member Avatar for epicasian

Hello, I'm trying to create my own game engine, and ran into a problem with nested classes. Currently, I only have one class that has any methods: [CODE] #ifndef WINDOWMANAGER_H_ #define WINDOWMANAGER_H_ #include <SFML/Graphics.hpp> #include <string> namespace tnt { class Engine { public: class GeneralCore { public: class WindowManager { …

Member Avatar for epicasian
0
109
Member Avatar for aukeebler

For a function protoype header can one be double while the other one is void? I'm trying to make the void displayPayment function work, but am a little lost. Should I turn the carPrice, Rebate, ect.. into void functions in the prototype, or can they work without doing that? Thanks …

Member Avatar for WolfPack
0
199
Member Avatar for joydsouza90

hey all so here's my problem: im just trying to learn a little opencv and ive been stuck at this for a while. When i run the following code, i get a runtime error " An application has made an attempt to load the C runtime library incorrectly ". This …

Member Avatar for WolfPack
0
782
Member Avatar for Dimesh

Al salamo Aleekom And Hi... Thank you for reading my topic... -------------------------------------------- Today and yesterday,Suddenly .... i get a problem when i writing any C++ code in ecplise i tried most of my previous codes but it give same problem...! Can anyone help?! here is the code: [CODE]#include <iostream> using …

Member Avatar for WolfPack
0
113
Member Avatar for Saleh

where can i find out a detailed information about [B]How to write a header file[/B] ?

Member Avatar for JCRARY
4
277
Member Avatar for King_Alucard

[CODE]#include <iostream> #include <cstdio> #include <iomanip> #include <cstdlib> #include <ctime> using namespace std; int main() { int rNumber = 0; int uNumber = 0; const int maxNum = 10; const int minNum = 1; const int range = maxNum - minNum; int counter = 0; //declare random formula srand((unsigned int)time(NULL)); …

Member Avatar for King_Alucard
0
156
Member Avatar for mystific

Hi! I have a problem with a bit of code i'm writing. What i want to do is: In the header file: [code=c] private: int board[16]; [/code] And in the .cpp file constructor [code=c] ScoreBoard::ScoreBoard() { int board[16]={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0}; } [/code] the compiler doesn't complain but i still get trash numbers …

Member Avatar for mike_2000_17
0
138
Member Avatar for rv_mup08

im newbie in C++ i have a project about how to get the Total Number of HOurs Worked From inputed Tine in and Time out Time in Format: 08:00 Time Out Format:12:00 Input From Monday to Friday DTR Output must be Display the Total no. of Hours worked: 102:59 --->Example …

Member Avatar for rv_mup08
0
2K
Member Avatar for csha_cs508

our task is to show the histogram in a vertical orientation like this: Sample Input/Output Enter a string: waka waka fifa Histogram for waka waka fifa * * * * * * * * * * * a f i k w I have here my code, but the output …

Member Avatar for jonsca
0
927
Member Avatar for ph34rgh057

i was woundeirng if anyone could help me with drawing a simple image perferably a .gif thank you.

Member Avatar for theguy126
0
214
Member Avatar for csha_cs508

please help me with this problem... i dont have any idea on how to make the code... Histogram is a process of representing the frequency of data in a chart. Write a C++ program that will simulate this process. Your program should read a string (only letters are allowed) and …

Member Avatar for wisaacs
0
587
Member Avatar for crodriguez08

Hey there, I need some help with the placement of constructors and how the second constructor would work (there's two of them). All I ask is for some explanation. These are the exact instructions: The default Constructor should build a dynamic array of size 3 for the grades. Another constructor …

Member Avatar for crodriguez08
0
475
Member Avatar for potato4610

This code is used to reverse a number in C++ but I have a problem. When I input 1010 or -1010, the output is -101 and 101. How should I fix this?[code]/* Christopher Langford U05799189 * clang4d@gmail.com * Assignment 3 Exercise 3 * July 23, 2010 * Macbook Pro w/Mac …

Member Avatar for Duki
0
592
Member Avatar for vavazoom

Hey...I'm working on a Gaussian elimination problem...my pivot doesn't seem to work correctly...the logic must be wrong. Also, does anyone know why "INFINITY" comes up as some of my random numbers chosen? Thanks in advance for any help! :) [code] Matrix::Matrix():N(0) { //Empty Matrix by default } Matrix::Matrix(int n) { …

Member Avatar for mike_2000_17
0
733
Member Avatar for altf4

I have written a program that will generate a random maze and solve it. The program uses a multidimensional array of a class that holds bool values for each wall, whether or not to show an * for the path taken, and if it is a dead end. here is …

Member Avatar for mrnutty
0
191
Member Avatar for aaronmk2

I understand that you are allocating memory for Stack, buy do not understand after :: and I thought that you only used :: when declaring classes not in the classes. [CODE] myTop= new Stack::Node(original.top());[/CODE] I can post the function class of the entire program if need be.

Member Avatar for mrnutty
0
97
Member Avatar for Garrett2011

take following class and two object definitions: [CODE=c++] class Rect{ public: enum centimeter; enum meter; Rect(double len,double wid,enum centimeter){ length=(len/100); width=(wid/100); } Rect(int len,int wid,enum meter){ length=len; width=wid; } //rest of implementation private: double length;//in meters double width;//in meters }; Rect obj1(10,5,Rect::centimeter()); Rect obj2(10,5,Rect::meter());[/CODE] two previous constructors have dummy enum …

Member Avatar for Garrett2011
0
2K
Member Avatar for ichigo_cool

Hi. I'm trying to make a two-dimensional array full of descriptions. As if they were map tiles for a text-based RPG. There's a point class that holds your coordinates and I use the Get_X and Get_Y functions to put into the map so it can read them. I'm just starting …

Member Avatar for ichigo_cool
0
104
Member Avatar for Ershad K

Dear all, I'm writing a small application in Linux using g++ compiler which asks for username and password. Could you please help me to mask the password entered by the user with * symbol? getch and _getch is not working. Please help. Thanks, Ershad

Member Avatar for Ershad K
1
7K
Member Avatar for VBNick

Hullo. I made a small webserver just to flex my winsock muscle, but it only works for small files like html files. Once I have processed the request to get the path of the file, I send the result like this: [code] ifstream fin; fin.open(URL, ios_base::binary | ios_base::in); if (!fin.good() …

Member Avatar for VBNick
0
177
Member Avatar for sabareesh

// find new size nNewArraySize = StrNewSizeForCharReplace(pszString, pszFindString, pszReplaceString); // nNewArry size is 1063 // alllocate memory pszTemp= (unsigned char*)malloc(nNewArraySize + 1); // add 1063 character in to pszTEmp // 1063 nLength = strlen(pszTEmp) // length is 1063 free(pszTemp); // Heap memory exception How can remove this exception

Member Avatar for Ancient Dragon
0
133
Member Avatar for Rickay

why doesn't this work? [CODE]int main() { fstream file; char output[100], pasword[100]; int a; const string x("Yes"); const string y("No"); string z; char b; cout << "\nEnter correct password to continue: \n" << endl; cin.getline(output, 15); if(output == "file.txt") { cout << "Change password? Type Yes or No. \n" << …

Member Avatar for Ancient Dragon
0
145
Member Avatar for jcrcarmo

Hello everyone, After I publish my C# VS2005 application (to be installed from CD-ROM), the crystal reports in it will not load, but if I run the application from debug, everything works fine. Does anybody know what's going on? Thanks a lot. Best regards, JC

Member Avatar for Deresse
0
129
Member Avatar for kunal kislay

[code] main() { double **vals = NULL; function(vals); } [/code] prototype : [code] //some other dll void function(const double**); [/code] it gives me error : cannot convert double ** to const double **. and yes i dont want to put extra burden on the user side(in main function) to const …

Member Avatar for Agni
0
109
Member Avatar for rajina

Command line arguments in C #include<stdio.h> int main(int argc,char *argv[]) { FILE *fp; char c; if(argc==2) { fp=fopen(argv[1],"w"); while((c=getchar())!=EOF) { putc(c,fp); } fclose(fp); fp=fopen(argv[1],"r"); while((c=getc(fp))!=EOF) { printf("%c",c); } fclose(fp); } return 0; } How to run this program in linux? I have tried these steps: 1. open terminal in linux …

Member Avatar for rajina
0
186
Member Avatar for bleedi

Hey again! I ran into a new problem in my university course exercises. Basically, I'm trying to read things from a .txt file. Every line is supposed to get converted into an object called "Client", and lines are formatted like this: <account:int> <firstName:string> <lastName:string> <balance:double> I have written my own …

Member Avatar for mrnutty
0
256
Member Avatar for ellainian

Please give me a sample code in MFC VC++ of CMovingButton move to left and move to right.

Member Avatar for Ancient Dragon
0
32
Member Avatar for jagan605

I have recently learned in school about the dreaded diamond.And I wrote a program using virtual inheritance to overcome the problems.I use g++ and I have the following errors with this program, [CODE]//doing to create an illustration for dreaded diamond #include<iostream> using namespace std; class vehicle { public: virtual void …

Member Avatar for Fbody
0
561
Member Avatar for jagan605

Iam using ubuntu 10.04 LTS.I have a problem in including graphics.h in the g++ compiler I am using.I have nearly tried all the possible solutions given while i googled about it. Please help me .I am a beginner to programming.

Member Avatar for jagan605
0
317
Member Avatar for ThrasherK

I need to write a function that sorts a two-dimensional array using this header: [CODE]void sort(int m[][2], int numberOfRows)[/CODE] my code is supposed to primarily sort the rows and secondarily sort the columns. The program is supposed to take ten points entered by the user and sort them. I cannot …

Member Avatar for ThrasherK
0
188
Member Avatar for khaled mohamed

hello , i have an trouble in switching between graphics mode and text mode i have an interface by using graphics mode and when you press in a key of it will transfer to a window by text mode when this operation occur the dimension of the second window is …

Member Avatar for khaled mohamed
0
119
Member Avatar for Takudzwa Tizora

how would one define RANDOM FILES as well as suggest ways of creating and updating them in Visual C++?

Member Avatar for mrnutty
0
105
Member Avatar for everard

I'm creating a logfile interpreter program that consists of two editboxes. The first editbox contains the original logfile code, and the second editbox contains the equivalent code of the first editbox in user-readable format. All I want to do now is, everytime I select or highlight a specific code in …

Member Avatar for Trepach
0
2K
Member Avatar for Duplaix

hey my name is duplaix..am new in c++ so i need help! I have to write the following set of c++ functions  fromBinaryToDecimal: The function must accept a pointer to a one-dimensional, dynamically allocated, Boolean array together with an integer representing its length as parameters. You may assume that …

Member Avatar for mrnutty
0
148
Member Avatar for ThrustinDuffman

Hello everyone! Im new to programming and Im working on an assignment but I keep running into trouble. My assignment is to make a trivia game and although I have made pretty good progress, I am stuck on one particular part. The part I am stuck at is I am …

Member Avatar for ThrustinDuffman
0
167
Member Avatar for PDB1982

Can someone explain to me, the purpose of the "public" and "private" options of a class?

Member Avatar for Knightly
0
557
Member Avatar for Frederick2

The memset function declared in memory.h is declared this way... void* memset(void* dest, int c, size_t count); and the MSDN example of its use I have shows this for setting the 1st four bytes of a buffer to a '*'... memset(buffer, '*', 4); The 2nd parameter confuses me a bit …

Member Avatar for Frederick2
0
644
Member Avatar for merse

Can you recommend a free C++ compiler and editor under windows which is good for error tracking? I mean, I can step the program line by line, and check the values of variables?

Member Avatar for Ancient Dragon
0
58
Member Avatar for vlad44

hi everbody I was opening all files in a certain folder I've used WIN32_FIND_DATA, FindFirstFile, FindNextFile. it works well but for certain extension that i ask the user to enter i.e it will get only all the files with the extension given by he user and ignore any thing else …

Member Avatar for Ancient Dragon
0
199
Member Avatar for Garrett2011

take two following classes: [CODE=c++] class Test1{ public: Test1()=default; Test1(char in1,char in2):char1(in1),char2(in2){} char char1; char char2; }; class Test2{ public: Test2()=default; Test2(char in1,char in2):char1(in1),char2(in2){} private: char char1; char char2; };[/CODE] I know in c++0x both of these classes are considered as POD types and we can initialize objects of them …

Member Avatar for Garrett2011
0
292
Member Avatar for Garrett2011

take two following classes and their constructors as samples: [CODE=c++] class One{ public: One(int a,int b):adad1(a),adad2(b){} private: int adad1; int adad2; }; class Two{ public: Two(int input[]){ for (int i=0;i<10;i++) araye[i]=input[i]; } private: int araye[10]; };[/CODE] considering objects with static storage duration, I think first constructor can be applied during …

Member Avatar for Garrett2011
0
405
Member Avatar for Garrett2011

How does an optimizing c++ compiler determine when a stack slot of a function(part of stack frame of a function) is no longer needed by that function, so it can reuse its memory? . By stack slot I mean a part of stack frame of a function, not necessarily a …

Member Avatar for Garrett2011
0
424

The End.