49,757 Topics

Member Avatar for
Member Avatar for sadiekins

I need help with my program. I have four errors with the ostream. It should be print my list of books. I know its something simple... I just can't figure it out! [code] #include <iostream> #include <string> using namespace std; //---------------------------------------------------------------------------- class Book { private: string title, author, genre, pubyear, …

Member Avatar for mvmalderen
0
159
Member Avatar for vsha041

Hi, I have written the following program but its not doing what's it supposed to do ! For some reason sometimes nothing or rubbish is being printed onto the screen. However, if I don't use function but instead do everything within main(), then its fine. What's the problem with the …

Member Avatar for mvmalderen
0
176
Member Avatar for shasha821110

Hi, all its me again! I got really stuck by the STL library and do not know how to correct that. Here is my class code: [CODE=C++] class A { public: A( const string& filename ) { ifstream file(filename.c_str()) ; string word; while( file >> word) { _word_list.push_back(word); } } …

Member Avatar for mvmalderen
0
160
Member Avatar for iTsweetie

Okay so the deal is, our instructor wrote what the class is supposed to look like (will be included with the code) and also gave us the Input, Preconditions, Process, Output, and Postcondtions of each function that is supposed to be used. I'm having trouble with an insert, delete, and …

Member Avatar for nucleon
0
179
Member Avatar for kevintse

Sorry but I don't know whether this is the right place to ask this. I want to create a scroll bar that can scroll the content in the main window. The difficulty is that I don't know how to calculate the accurate length of the whole content (blending of English …

Member Avatar for nucleon
0
103
Member Avatar for tomtetlaw

I am using OpenGL and i am trying to get this simple program to work, here is my code; [code=c++]void DrawScene ( void ) { glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glMatrixMode ( GL_MODELVIEW ); glLoadIdentity ( ); //Triangle glPushMatrix ( ); glTranslatef ( -1.0f, 1.0f, 0.0f ); glBegin ( …

Member Avatar for tomtetlaw
0
217
Member Avatar for tonyaim83

Hi What is require is to get the path of current working directory.I m working on windows-XP. Is any function avaliable in c/c++ i could find on net #include <unistd.h> char *getcwd(char *buf, size_t size); But not working i don't know why. Can u provide small code of how to …

Member Avatar for adam1122
0
6K
Member Avatar for shasha821110

Hi, all its me again! Still stuck with the STL function usage. but this time face the sort function problems! here is my class: [CODE=C++] class A { public: A( const string& filename ) { ifstream file(filename.c_str()) ; string word; while( file >> word) { _word_list.push_back(word); } } StringIntVector topNWords(size_t …

Member Avatar for Narue
0
145
Member Avatar for vijaysoft1

I have a program to find the [B]Sin[/B] value of a given value(in radian) . It is working properly , but i want a better program or can u please give me a small explanation about my code . please ... in my program n=2; // what is this meaning …

Member Avatar for vijaysoft1
0
147
Member Avatar for kelechi96

What are and how do I use vectors ? I have read some tutorials on them but I don't understand fully how they work.

Member Avatar for Narue
0
114
Member Avatar for mat1989

Hi everyone. Having some issues with my program I need to make for an assignment. There is a part that needs to be able to look for upper-case letters within a html tag ( which is located in a text file) It then has to say where in the file …

Member Avatar for Xlphos
0
117
Member Avatar for rmlopes

Hello, I developed an application in VC++ an now I want to compile it using GNU++ to be run on a ubuntu server (where I am actually trying tocompile it). After some syntax/usage corrections I get an error which I totally don't understand (and I don't have it in VC++, …

Member Avatar for rmlopes
0
120
Member Avatar for shasha821110

Stuck by another problem about the vector, map functions the topnwords function is to find the top n times words occurrence Here is my code: [CODE=c++] //stringvector is the type-- //typedef vector< pair < string, int > > StringIntVector; StringIntVector TextUtil::topNWords(size_t n) const { map<string, int> freq; for(size_t i=0; i<_word_list.size(); …

Member Avatar for nucleon
0
191
Member Avatar for Shabtai

The following is a statement from a program on linked lists given to us in class. I do not understand why I have to add & for address when what is passed is a pointer which means it is passed by reference.: void CharNode::headInsert(CharNode* &head, char *d) { head = …

Member Avatar for siddhant3s
0
384
Member Avatar for sadiekins

Hello. I am trying to write a doubly linked list that uses data from a class. I have this class that I would like to use... [code] #include <iostream> #include <string> using namespace std; class Book { private: int PubYear; //Variables string Title, Author, Genre, Publisher; public: Book( ){}; //Default …

Member Avatar for sadiekins
0
98
Member Avatar for kyosuke0

hi, this is embarrassing, for whatever reason I am getting "Don't know how to make target driver.o" whenever i type make. There is only one file named "driver.cpp" in the directory that i have to compile. I am staring at tutorials and don't understand why this won't work. heres whats …

Member Avatar for Duoas
0
128
Member Avatar for shasha821110

Hi, all i have one assignment about using some of the STL to read from .txt file and count the words and find the topnwords etc. So i implement my class like that: [CODE=c++] class A { public: A( const string& filename ) { ifstream file( filename.c_str() ) ; string …

Member Avatar for mvmalderen
0
128
Member Avatar for kelechi96

Hello I have created a sucsessful prime number finder however I wish to retrive the start number from a file the last line shows how I tried to do this however it failed any solutions ? [code=C++]/* By Kelechi Nze My first prime project*/ #include <windows.h> #include <iostream> #include <fstream> …

Member Avatar for kelechi96
0
181
Member Avatar for mat1989

Hi guys. Im doing an assignment, I am getting on ok with it but I am sadly really stuck at the moment. The part I am stuck on involves counting html tags in a text file. I have thought of a method of doing this but unfortunately I have no …

Member Avatar for Xlphos
0
1K
Member Avatar for f.ben.isaac

Please tell me what do you think of the written code below, is it easy to follow? Does the code tells you what it does, or you have struggled realizing whats going on? and so on. Feel free to give suggestions, tips, advices and criticize! This will help me and …

Member Avatar for f.ben.isaac
0
268
Member Avatar for greg022549

Going through one of my old .c file I have a line as follows: scanf("%i", &tside); I would like to convert it c++ code. Can someone show me how to do that? Sincerely, greg022549

Member Avatar for adam1122
0
114
Member Avatar for f.ben.isaac

1. Simple calculator - nothing fancy [code]/**program description: * * simple calculator written for beginners. * This program asks user to enter an arithmetic * expression that contains two numbers and one * operator. User will be given the result of the * calculation. Operators allowed to be used * …

Member Avatar for mvmalderen
0
258
Member Avatar for vijaysoft1

Please give me the logic or a simple program to convert a Roman letter to Numeral . Please.......

Member Avatar for siddhant3s
0
97
Member Avatar for hurbano

this simple cout statement and i do not know why. the outputs are mixed up and i get some random numbers i didnt even input.please help [code=cplusplus] #include <iostream> #include <string> using namespace std; int main() { string Pname, CEmployer; int age; cout<<"Patients Name:"<<endl; getline (cin, Pname); cout<<"Age:"<<endl; cin>>age; cout<<"Current …

Member Avatar for mvmalderen
0
120
Member Avatar for everydaybh

I want to create a program that asks the user to enter two vector (size and direction), and calculates its addition through turning it into components (using OOP). here's what I've got so far (I don't know how to fix the errors), I'm not sure what's wrong/ to do next …

Member Avatar for mvmalderen
0
177
Member Avatar for deppsgirl

hi. this is my first post here, my name is jen, someone in my class told me about this site and how helpful all you guys are and im so lost i thought id come try and see if someone can help me understand :( i dont even know where …

Member Avatar for mvmalderen
0
166
Member Avatar for jam7cacci

my task is to sort the input numbers from lowest to highest but i just cant make it work... i've tried different ways and I know there's a problem in my code. hope you can help me out. thanks! [code] #include <iostream.h> struct trial { int age; } getcount[5]; void …

Member Avatar for jam7cacci
0
166
Member Avatar for NicAx64

ahh , finally I backtrack the bug. Believe me I'm not saying that I'm experienced but many years I have been working with C++ , at least 5 yrs .I'm working with the C compiler since I was at the 7th grade. however the fun part is not boosting about …

Member Avatar for Will Gresham
0
524
Member Avatar for Nemoticchigga

This is a general question. I am familiar with accessors and mutators (getters and setters). I have now been reading up on semaphores. I am having trouble finding out differences between them/how they are related. Can anyone help me out with an explaination or a link? Thanks. P.S. - sorry …

Member Avatar for ArkM
0
132
Member Avatar for gangsta gama

Hello all, My code isnt working. It is supposed to be a RPG World of Warcraft game lol. 1) When I have [code=c++]if (inventory.size() == MAX_ITEMS) { inventory.push_back("Rusty Armor"); } else { deleteItem(); } [/code] 2) My deleteItem() function dosnt work, is their another way to do this? Here is …

Member Avatar for gangsta gama
0
122

The End.