49,761 Topics

Member Avatar for
Member Avatar for daviddoria

I was looking at this: [url]http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.18[/url] I don't understand [code] File f = OpenFile("foo.txt"); [/code] It seems like File is one class, and OpenFile is a separate class, so how can you assign an OpenFile to a File? Also, is it necessary to have this second class? Why not something …

Member Avatar for Ancient Dragon
0
264
Member Avatar for BlackStar

[ICODE] #include <iostream> #include <cstdlib> using namespace std; struct A { A *B; }; struct C{ C*D; }; int main() { A * Z = new A; C * Y = new C; Z = Y; cin.get(); return 0; } [/ICODE] it says cannot convert Z to Y in assignment.

Member Avatar for NathanOliver
0
97
Member Avatar for bmcutler011

[code] #include<iostream> #include<fstream> #include"d_nodel.h" using namespace std; int main() { dnode<double> *listA = new dnode<double>; dnode<double> *listB = new dnode<double>; double sz1, sz2; int val1; //first set of integers int val2; //second set of integers ifstream inFile; //declares the inFile ofstream outFile; //declares the outFile //Read in a file to …

Member Avatar for NathanOliver
0
142
Member Avatar for lqdo

hello all, I'm getting some unexpected behavior from the ifstream object when using the open method. im reading the following characters from a text file: [CODE] ############### # #X# # # ### # # ### # # # # # # # ## ## # # # WWWW###WWWW # # …

Member Avatar for NathanOliver
0
127
Member Avatar for musique

What is wrong with my sorting function? I am trying to put numbers in ascending numbers. [code] void sort(int array[], int numts) { int lowIndex, lowest; for (int count = 0; count < (numts-1); count++) { lowIndex = count; lowest = array[count]; for (int index = count + 1; index …

Member Avatar for musique
0
249
Member Avatar for NathanOliver

hi i have a very large array that i want to populate but i don want to run the for loops every time so i thought i would right a program to output text to fill the array and was wondering if this would work. the array is [icode] int …

Member Avatar for NathanOliver
0
104
Member Avatar for rahul8590

i am working on my project which is on regeression of lines . well i have been successful in fitting a straight line to the given set of coordinates . since i have come so far after a lot of striving , i have been a bit exhausted on writing …

Member Avatar for Salem
0
669
Member Avatar for waldchr

After much frustration of trying to figure it out on my own, I am finally ready to admit that I need help. Does anyone know how to compile allegro 5? (or better yet have a precompiled version I could get my hands on) I have tried many tutorials and none …

Member Avatar for tux4life
1
626
Member Avatar for daviddoria

To redirect clog, I have been using this: [code] std::streambuf* clog_save; std::ofstream ofs; clog_save = std::clog.rdbuf(); ofs.open(LogFilename.c_str()); std::clog.rdbuf(ofs.rdbuf()); cout << "Test cout." << endl; std::clog << "Test log." << endl; std::clog.rdbuf(clog_save); ofs.close(); [/code] However, it seems like bad "code reuse" practice to have to put this in every program I …

Member Avatar for ArkM
0
173
Member Avatar for olejl

I am trying to learn some c++. To do this I have chosen to write an emulator. I had it up and running, but decided to try to make a better architecture. I have a strange problem that I don't understand. If I compile the following code (Visual C++ 2000 …

Member Avatar for ArkM
0
620
Member Avatar for therealsolitare

Hey everyone, I've been getting my rear end kicked by this homework assignment. We were given the task of writing up a command line version of Othello (Reversi) in a higher level language, which I chose C++ to do so in. My C++ version of the code is working great, …

Member Avatar for Salem
0
6K
Member Avatar for saadjaved14

Hey... ok before i start i want to say that i'm not a very good programmer... and i'm new with this... and i got a project that i have to submit in 2 days so i badly need help!! ok the problem is: I'm using binary file handling, a code …

Member Avatar for ArkM
0
103
Member Avatar for U_A_G

so we are starting arrays and our task is to go back to our assignment 2 (functions) and he wants us to run the program using arrays. im pretty stuck and have no clue what to do. [B]heres how assignment (functions)2 looks[/B] [code] #include <iostream> using namespace std; void getEmployeeData …

Member Avatar for VernonDozier
0
126
Member Avatar for weary01

hi there, i do hope someone can help with my delima. yes this is homeowork but i am 80% through my program and only wish to get some guidance on my program. my program has a number of things it has to do and one the things i am having …

Member Avatar for NathanOliver
0
114
Member Avatar for bunnyboy

Hello! I am making a postfix calculator and I want to add in some equation integrity checking. Everything seems to work ( it needs to be done some little improvements, but overall it is working), except when I am checking for the blank spaces the program do not work the …

Member Avatar for bunnyboy
0
159
Member Avatar for pczafer

how im gonna loop menu if option not 1 or 2 ??? [CODE]void display( ) { int option; system("cls"); //clear screen cout<<endl<<endl; cout<<"\t * Display Menu *\n"; cout<<"\n\t1. Display For Certein Date"<<endl; cout<<"\t2. Display All Appointments"<<endl; cout<<"\nEnter Option Number: "; //Enter option cin>>option; cin.get(); switch ( option ) { case …

Member Avatar for tux4life
0
185
Member Avatar for Sky Diploma

As i have written Atoi(); Now i have written Itoa. Here I have used a method of getting the last digit stroring it in an array and then reversing the array to get the required answer. I look forward for Improvements in this code. [CODE=C++] /**************************************************************************** Function Name:: itoa(int ,char …

Member Avatar for Sky Diploma
0
538
Member Avatar for colesefini

Im currently doing a project in QT and when I compile my project with my header/source files that i created, I get this "error: expected constructor, destructor, or type conversion before ‘->’ token ". Essentially i've created my own classes outside of QT and my objects work fine etc but …

Member Avatar for tux4life
0
65
Member Avatar for bilbatori

Hi, I've been trying to identify the error in this code of insertion in a 2-3 Tree. I do know its something with the search function...Can some one figure out whats wronge with the code?? [code=language] bool Two3::Insert(int val) { int x=val; bool done=false;//inserted or not?? if (IsEmpty())//empty tree creating …

0
81
Member Avatar for frossie

for example the sentence in the text file is "daniweb offers the best solutions for C++. the website is www.daniweb.com." i have the user to search the word "daniweb". by using ifstream to read word by word, this is part of my codes [CODE] ifstream file ("lines.txt"); string word; bool …

Member Avatar for rahul8590
0
103
Member Avatar for moteutsch

How can I clone an object in C++, so it is a seperate object, but exactly the same as the original? Thanks, - Moshe

Member Avatar for moteutsch
0
76
Member Avatar for timb89

i want to make a prgoram that will read in a set of numbers and determine whether or not they are prime numbers, this is what i got so far any ideas? [code] #include <iostream> #include <queue> #include <vector> using namespace std; int main() { queue <int> input; queue <int> …

Member Avatar for timb89
0
74
Member Avatar for sinapse

I have this problem to solve for preparing for the olympiad and i'm not quite fond of the functions so that i want to do it classically but i find it harder.Here it goes: "During a desert operation a group of soldiers were lost from different squads.After the storm passed …

Member Avatar for Salem
0
150
Member Avatar for willydlw

my makefile: [code] DRIVER_SRC = PumaDriver.cpp PumaBody.cpp PumaMotor.cpp base_manipulation.cpp serialPort.cpp DRIVER_INC = PumaDriver.h PumaBody.h PumaMotor.h base_manipulation.h serialPort.h silvermax_commands.h All: $(DRI_SRC) $(DRI_INC) g++ -Wall -Wextra -g3 -fpic `pkg-config --cflags playercore` -c $(DRIVER_SRC) g++ -Wall -Wextra -nostartfiles -shared -rdynamic -o libPumaMotorDriver.so PumaDriver.o PumaBody.o PumaMotor.o serialPort.o base_manipulation.o install: cp *.so /usr/local/lib uninstall: rm …

Member Avatar for Salem
0
188
Member Avatar for Lukezzz

Hi I wonder how it will be possible to get the current date and time. I have looked around and there are many different ways to retreive this. I wonder what could be a good way to do that. As for now, I would like to return a string for …

Member Avatar for ArkM
0
101
Member Avatar for fadia

Metro supermarket is a new supermarket opening in Riyadh. It offers attractive discounts for its customers. Write a program that will display to the user his new total price after discount. The program should read the total price from the user, calculate and display the new total price based on …

Member Avatar for fadia
0
155
Member Avatar for ShadowScripter

Mmm, I just love these error messages, I don't understand them what-so-ever and I can't interpret them. (Unsure where the post should be in the forum) I'm getting this error message at build time (Using VC++): [code=cpp]1>Linking... 1>main.obj : error LNK2019: unresolved external symbol _DirectDrawCreate@12 referenced in function "long __cdecl …

Member Avatar for Ancient Dragon
0
262
Member Avatar for nanodano

I've been trying to solve this problem for a while now with no luck. I want to monitor an input buffer(cin) for a keypress. The catch is, I don't want it to hang if the buffer is empty. [INLINECODE]getch()[/INLINECODE] and [INLINECODE]peek()[/INLINECODE] won't work because one waits for a keypress and …

Member Avatar for cniggeler
0
147
Member Avatar for soppyhankins

Hello again all!!! I just have two quick questions... 1.) Is it possible for one to run a program through the "system(command)" and have the output come out on top of an SDL program? Like if I had a background of some sort and typed "system(echo "Hello!")" could I have …

Member Avatar for soppyhankins
0
206
Member Avatar for mightykyle

well i'm trying to get my shuffler to work but i keep getting one. any ideas? #include <cstdlib> #include <string> #include <ctime> #include <iostream> using namespace std; const int number_of_cards = 52; void shuffle(int list[], int size) { srand(time(0)); for (int i = 0; i < size; i++) { int …

Member Avatar for mightykyle
0
197

The End.