51,592 Topics

Member Avatar for
Member Avatar for Carrots

Hi, I have been wrestling with this program all day and am looking for some help. I have never separated a program up before into separate files (main.cpp, base.h and base.cpp). What I'm trying to do is call a function from main() and have that function return a pointer to …

Member Avatar for Carrots
0
173
Member Avatar for Broseph

Hey guys. I hate to have to ask for help but I've run out of ideas. The program I'm trying to write is supposed to write a random list of numbers 0 - 4 and then count the occurrences of each number. The only thing I can't get to work …

Member Avatar for Broseph
0
86
Member Avatar for rudekhan

i just installed c++3.0 in XP downloaded from internet . But when i run very simple COUT<<"hello" code it doest produce out put. As i compile and run with out error but no output i can see. I have LCD is there any problem even i chaged the LCD and …

Member Avatar for rudekhan
0
275
Member Avatar for ELBUF

The title isnt too clear, and I wasnt sure what to title it, so Ill explain it here. I am making a calculator that can handle big numbers such as scientific notation and powers. A big number is one decimal (coefficient) times ten to a power (exponent). Ex. 3x10^15 or …

Member Avatar for ELBUF
0
126
Member Avatar for casjackkwok2001

Write a function that accepts an int array and the array’s size as arguments. The function should create a new array that is [B]twice the size of the argument array[/B]. The function should copy the contents of the argument array to the new array. I tried to run on it, …

Member Avatar for Ancient Dragon
0
161
Member Avatar for jimJohnson

I am working on an assignment and was wanting to know if one of u guys could let me know if I have 1. correct before I go to 2. Here are the instructions... 1. read in the data then displayed the data. 2 Add the following a. add a …

Member Avatar for jonsca
0
249
Member Avatar for v_janssens

Hi, I'm trying to find a way to calculate the eigenvalues and eigenvectors for a square symmetrical matrix. I have used MATLAB to do this before and the solution was as simple as; [V,D] = eig(A) I'm wondering if there is a simple solution like this in c++. I am …

Member Avatar for DavidB
0
302
Member Avatar for OnTheRadio

My assignment is: Your goal is to write a program that sorts a list of 4-letter words using different sorting algorithms and report the fastest method. First your program should prompt the user to indicate the number of words to generate. Your program should then generate a list of random …

Member Avatar for OnTheRadio
0
117
Member Avatar for dnalor

[code=cplusplus]#include <iostream> #include <conio.h> #include <iomanip> #include <fstream> using namespace std; const int numStudents = 5, numQuiz = 10, numAssign = 10, numFinal = 1; const int totalGrades = 21; void computeStudAver(const int grade[][numQuiz], double stAve[]); void computeQuizAver(const int grade[][numQuiz], double quizAve[]); void printall(const int grade[][numQuiz]); int menu(); int main(); …

Member Avatar for brillantes
0
87
Member Avatar for TheWolverine

Hi all, I was wondering if there is any standard way in C++ (perhaps in the standard library) of handling mathematical equations that are composed of +/- signs. For instance, if you are given the equations: [quote] y = +/- sqrt(x) z = +/- y [/quote] Is there an efficient …

Member Avatar for TheWolverine
0
150
Member Avatar for jdpjtp910

I have a code and its almost done. Its for a school project and I am stuck. I have DivSales and a CorporateSales.cpp. The programs should ask the user for 6 divisions quarterly sales. Display the results into a table and give a total of sales. My total feature is …

Member Avatar for Murtan
0
1K
Member Avatar for daviddoria

This code: [code] #include <iostream> class Parent { int name; class Child { int school; void test() { std::cout << this->name; } }; }; int main(int argc, char *argv[]) { Parent MyParent; return 0; } [/code] Generates this error: [code] error: 'class Parent::Child' has no member named 'name' [/code] Is …

Member Avatar for HealBrains
0
174
Member Avatar for rockstar8577

For some reason i cant output to a file unless it was already created. Here's my code. [code] fstream myfile; myfile.open (filename.c_str(), ios_base::in); if (!myfile) { myfile.close(); myfile.open (filename.c_str(), ios::out); avatar.name = name; avatar.init(); myfile << "Name = " << avatar.name << endl; myfile << "hp = " << avatar.hp …

Member Avatar for rockstar8577
0
118
Member Avatar for AJW

hello all, I'm taking a C++ class at my local community college. A project that was assigned was to make a menu program. I am about 90% done (I think), when I ran into this issue: when making a selection, the program doesn't know how to handle decimal numbers. The …

Member Avatar for AJW
0
110
Member Avatar for daviddoria

I have some code that uses _finite (I think from float.h) that my linker complains is not declared. I think this might be a "windows only" function. Is there an equivalent function that I can call that will work cross platform? Thanks, Dave

Member Avatar for daviddoria
0
217
Member Avatar for jigglymig1

i have to write a program that will read in a txt file that also has periods, exclamations, question marks and <CR>(returns). and do some other stuff. right now i am having trouble with comparing the words..... this is at the very bottom of my code [CODE]#include <iostream> #include <fstream> …

Member Avatar for mrnutty
0
84
Member Avatar for tnclark8012

I've been tasked with implementing either the min-max function or alpha-beta pruning to code AI for the game Gumoku (connect 5, vertical, horizontal, or diagonal). In both algorithms an evaluation function is called to analyze the board of play. Is there any "easy" way to do this? My initial plan …

Member Avatar for MyrtleTurtle
0
168
Member Avatar for D4n1sD

Hello, I am wondering how its possible, to make a server that you can connect to it, through IP and Port and than send data to it, For example I am trying to make a simple multiplayer game. But I am really amateur on connections etc. So please help me …

Member Avatar for D4n1sD
0
87
Member Avatar for BeyondTheEye

For an electronics project, I have to access the TxD, RTS and CTS pins of a serial port individually. Well, any 3 pins could be used, but those 3 are preferred. All I've been able to find on the microsoft website are functions to access the serial port as a …

Member Avatar for BeyondTheEye
0
264
Member Avatar for dieter22

Hi there! I'm new to c++ and I'm having problems with ifstream. I assume that my question is pretty stupid but here you go: I've got something like: [code=c] ifstream infile(inname); [/code] Furthermore I do have an array - let's call it Array - which contains several filenames I want …

Member Avatar for TerishD
0
388
Member Avatar for ndayala

[CODE]#include <iostream> #include <list> using namespace std; template <typename T> class superlist : public list<T> { public: // squish() is a mutator that "squish" together adjacent duplicate // elements in a list. // // Example #1: // [3, 3, 4, 3, 3, 3, 2, 8, 8] // becomes... // [3, …

Member Avatar for ndayala
0
111
Member Avatar for squarey

Hi Guys I want to build an application which can be used to empty the content of bad (remapped) sectors. At the moment I really dont know where to start, so I am hoping someone can give me a push in the right direction. It would also be nice if …

Member Avatar for Salem
0
202
Member Avatar for karolik

So I made a template...I tried declaring a string linkedlist like so... [CODE]LinkedList<string> str; [/CODE] Then i called the function insertLast to insert a string called hello..like so... [CODE]str.insertLast("hello")[/CODE] Then it gives me null pointer error...I cannot see how there can be a null pointer...help would be appreciated..Here is the …

Member Avatar for mattbond
0
182
Member Avatar for soapyillusion

Hi all, sorry to once agian come begging for help, but the professor wants us this time to have the program have a function read the word then for each letter have another function confrim if the letter is a vowel or not, then have the first function remove the …

Member Avatar for soapyillusion
0
359
Member Avatar for liveshell

I have following peace of code, when i check it with valgrind it gives me "537 bytes in 19 blocks are possibly lost in loss record 12 of 12" Following is the code: CManager.h [CODE]class CManager enum RespType_en { eInvalidRes = 0, eAuthRes, eActivateRes, eSetStateRes } map<RespType_en, string> m_mRespTags; [/code] …

Member Avatar for Salem
0
758
Member Avatar for Xhoana

Hi everyone! I'm new to C++ and i was told Dev CPP is a good compiler. I installed it and anytime i try to open it comes out this message: There doesn't seem to be GNU Make file in PATH or in Dev C++'s Bin path. Please make sure that …

Member Avatar for Salem
0
122
Member Avatar for react05

I need some help with postfix expression please. I've only been able to find examples about changing from infix to postfix. With the code provided below, I want it to the following: 1. if the token is an operator (it is a +, -, *, or /) a. two items …

Member Avatar for react05
0
206
Member Avatar for pamelaanne05

Here's my code for the upright triangle. Now I'm hard up on doing the code for inverted triangle, I'm working on it right now, but a little help would be great. [CODE]#include <iostream.h> #include <conio.h> void main() { int len,ht,ch,cho,sz,col=20,ctr=1; cout<<"\nTRIANGLE"; cout<<"\nEnter Size: "; cin>>sz; if (sz<5||sz>20) cout<<"Size must be …

Member Avatar for pamelaanne05
0
88
Member Avatar for daviddoria

I am trying to compile some old code a colleague gave me. I have MyClass.h [code] class MyClass { public: static int UseIndex; .... }; #include "MyClass.inl" [/code] MyClass.inl [code] ... int TreeNodeData::UseIndex=1; ... [/code] I am getting: [code] multiple definition of `MyClass::UseIndex' first defined here [/code] I got several …

Member Avatar for daviddoria
0
221
Member Avatar for desperado85

I have a CString : CString data; data.Format = ("!64.8 Px.1= 1200"); I would like to copy the number 1200 from data to another CString data2. Anyone can help? Thanks in advance

Member Avatar for mitrmkar
0
97
Member Avatar for karolik

So i have Class Parser and in this class is constructor [CODE]Parser(string s){ // constructor tokens = s.c_str(); // convert to a C string opStack.push(END); // initialize opStack }[/CODE] tokens was defined as const char *tokens in private ; That is in the parser.h file However when i try to …

Member Avatar for mitrmkar
0
110
Member Avatar for Abdel_eid

i need a c++ compiler with a graphical user interface which can easily be used and that contain many option like for example microsoft visual ,simply i can write the code on a gedit and compile it by using : g++ "file name" -o test ./test but it is so …

Member Avatar for Abdel_eid
0
149
Member Avatar for Luks

In have been coding a small program to calculate the % body fat. But is giving the error C2064 as above. Any help will be appreciated guys! The error is here; [CODE] /Compute Body fat percentage for male if (gender == "Male"){ BFat = 495/(1.0324-.19077(log(abdomen-neck))+.15456(log(height)))-450; // THE ERROR IS HERE …

Member Avatar for Luks
-2
221
Member Avatar for tnclark8012

Hey everyone, I'm having an issue with the simplest vector functions. I'm trying to add a Piece object to a vector, but it's data members are being changed when I do... am I missing something? [CODE] /* Piece.h */ #ifndef _PIECE_H #define _PIECE_H class Piece { public: Piece(); Piece(int r, …

Member Avatar for tnclark8012
0
172
Member Avatar for qk00002

I only have one more small question is I have made a textbox in C++ CLR, how can I load text from a text file? thank you.

Member Avatar for kvprajapati
0
246
Member Avatar for ravenrider

Hello I had the seg fault last night, after making some changes, I don't have it anymore, the program compiles but it doesn't do anything ! " the program should read in data from the file in this following form : 2 Dell inspiron 299 Hp pavilion 499 " simply …

Member Avatar for Murtan
0
151
Member Avatar for BobC22

Hi, I am going to be attending university next year on a coding course, I am currently working through an exercise in the Deitel book How To Program and I have encountered some errors in my program. Any help would be much appreciated. Bob Here is my code cube.h [CODE]#include …

Member Avatar for mrnutty
0
169
Member Avatar for pato wlmc

[COLOR="Green"][B]Well, that's it, i'm trying to compile a dialog box:[/B][/COLOR] [CODE] case WM_COMMAND: switch(LOWORD(wParam)) { case ID_HELP_ABOUT: { int ret = DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_ABOUT), hwnd, [COLOR="Red"]AboutDlgProc);[/COLOR] if(ret == IDOK){ MessageBox(hwnd, "Dialog exited with IDOK.", "Notice", MB_OK | MB_ICONINFORMATION); } else if(ret == IDCANCEL){ MessageBox(hwnd, "Dialog exited with IDCANCEL.", "Notice", MB_OK | …

Member Avatar for mitrmkar
0
580
Member Avatar for marlowd

We are running an application in win32/Vista, and sometimes, something has changed the permissions so we can not access them. We have a admin co-process that can change the permissions, but I am not sure what functions to call to insure that we have permission to access the files, from …

Member Avatar for mitrmkar
0
113
Member Avatar for qk00002

Hi, I am working on visual studio 2008 C++ and I have done the C++ general code, my question is can I convert my general code to be C++ CLR in visual studio 2008? This will make my work easier. And I have one more small question is I have …

Member Avatar for jonsca
0
251
Member Avatar for fugnut

Hello all, I have a project in which I need to open an external file which contains to columns of numbers ie: 1000 1000 1111 500 1500 1000 2000 900 2222 2000 2500 2000 3000 1500 3333 2000 3500 2000 4000 600 4444 2500 4500 2000 5000 2500 5500 2222 …

Member Avatar for mitrmkar
0
115
Member Avatar for yznk

My program deals out 7 cards. And then determines what is in the hand. A pair, two pair, three pair, four of a kind. However its not finding any of those right and im not sure why. [CODE]#include <iostream> #include <iomanip> #include <cstdlib> #include <ctime> using namespace std; #include "DeckOfCards.h" …

Member Avatar for Salem
0
76
Member Avatar for tararengan

can I call a function B outside a class (say, a global function) from a member function Aof that class? if so, how do I specify the scope? Using :: B ? thanks.

Member Avatar for mrnutty
0
118
Member Avatar for josolanes

Memo.h: [CODE=cpp] #ifndef _MEMO_H #define _MEMO_H #include <stdlib.h> #include <string> #include <typeinfo> #include <iostream> #include "Date.h" #include <map> #include <vector> using namespace std; class Memo { public: map<Date, vector<string> > Appointment; //void delMemo(int x); void addMemo(Date myDate,string x); }; #endif /* _MEMO_H * [/CODE] Memo.cc [CODE=cpp] #include <stdlib.h> #include <string> …

Member Avatar for josolanes
2
224
Member Avatar for valeriy_zf

How to assign the graphic object (Line, Rectangle, Ellipse) to the Form? Lets see this example: I created the Line object somewhere in the program: [CODE]namespace TEST_Graf { using namespace System::Windows::Forms; // this code requires links to: PresentationCore, PresentationFramework, WindowsBase using namespace System::Windows::Controls; using namespace System::Windows::Shapes; using namespace System::Threading; public …

0
75
Member Avatar for tetron

Hi, When using Microsoft Visual Studio, building in release the code just hangs and fails to execute but with Debug it builds and runs to the end. And I don't see why there should be a difference. I did a shutdown then clean and a rebuild of solution but the …

Member Avatar for HealBrains
0
116
Member Avatar for sexyzebra19

I'm using [code=php] for (int i = 0; i<mdim_; i++) { for (int j = 0; j<ndim_; j++) { data_[j * ndim_ + i]; } } [/code] to change the matrix 1 3 2 4 stored in data, into row order. If I print data_[j * ndim_ + i]; to …

Member Avatar for sexyzebra19
0
2K
Member Avatar for clutchkiller

[code] void encrypt::transform() { int length = 0; char *buffer; char ch = ' '; int i = 0; fileEncrypt.open("filter.txt", ios::in | ios::beg); fileEncrypt.seekg(0, ios::end); length = fileEncrypt.tellg(); fileEncrypt.seekg(0, ios::beg); buffer = new char [length]; fileEncrypt >> ch; while(!fileEncrypt.eof()) { buffer[i] = ch; i++; fileEncrypt >> ch; } for(int j …

Member Avatar for jonsca
0
103
Member Avatar for ipride

anyone help me please I need to convert this C++ to assembly int number = 0; int targetValue = 1; int nbrTerms = 0; cout<< "enter number" cin >> targetValue; while( nbrTerms <= targetValue) { nbrTerms = nbrTerms + ( targetValue * targetValue) targetValue ++; } cout<< "total terms: "nbrTerms; …

Member Avatar for gerard4143
0
114
Member Avatar for fugnut

Hello again all, I have a project in which I need to read in a text file: 1000 1000 1111 500 1500 1000 2000 900 2222 2000 2500 2000 3000 1500 3333 2000 3500 2000 4000 600 4444 2500 4500 2000 5000 2500 5500 2222 5555 2000 6000 1999 this …

Member Avatar for WaltP
0
95

The End.