- Upvotes Received
- 3
- Posts with Upvotes
- 3
- Upvoting Members
- 2
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
Programmer a long time ago, getting back into it now.
- PC Specs
- Platform: Mac mini running OS X, using Qt as my IDE and C++ as my primary programming language.
Hi, all - I'm relatively new to iterators, and to template functions, so I suppose it was inevitable that the first time I tried to combine them, I'd run into a problem. Here's the function: [CODE]template <class T> int getVectort(ifstream & s, long nbrCells, typename vector<T>::iterator iter) { int rc … |
|
Re:
what I mean by undefined error is because I don't know what the error is about. :P, actually it's because the error not from the code itself, but it's about a compiler that can't defined some sort of file... btw, as title said, the error is from the code in … |
|
Re:
What I need to do is... make the output continuous. For example when I input a number it displays character it represents in the current message line. What I need is for each input to add to the next line. In other words when I input 39 I get G … |
|
Re:
I have this assignment for adding two polynomials using operator overloading. I am new to C++ and am having trouble putting the pieces together for the operator overloading portion of the code. I understand how to add two poylnomials together, I just don't know where to begin to put down … |
|
Re:
[CODE] // Node .h #ifndef NODE_H_INCLUDED #define NODE_H_INCLUDED # include <iostream> using namespace std ; class Node { private: int object ; Node *nextNode ; public: Node() ; void setObject(int x) ; void setNext(Node *next) ; int getObject() ; Node *getNext() ; } ; #endif // NODE_H_INCLUDED //----------------------------------------------------- // Node.cpp … |
|
Re:
Though I would be able to figure this out but for some reason my if statements are just not working. What I'm trying to do is date validation. I call this function passing in day, month, year. The issue I'm having the the if statement. I can't seem to get … |
|
Re:
[CODE] #include <cstdlib> #include <iostream> #include <string> using namespace std; bool checkleap(int year); int main(int argc, char *argv[]) {string s1; int year,month,day,inbetween,dayspassed; char dash1,dash2; s1="Today is day number: "; bool leapcheck; leapcheck=checkleap(year); cout<<"Enter a date, in the form of MM-DD-YYYY: "<<endl; cin>>month>>dash1>>day>>dash2>>year; switch (month) {case 1: 31-day=inbetween; [COLOR="green"]//Line 19[/COLOR] 31-inbetween=dayspassed; … |
|
Re:
I'm trying to figure out where a proper place to put a comparison counter to count the number of 'comparisons' made in a quick sort is. This is my code so far, I have one counter where I think it should go, but I'm not sure if it should place … |
|
Re:
â–ºWrite a class implementation for a class Student that contains the data members: 1. Data member for the student Name. 2. Data member for the student Number (ID). 3. Data member for the student Faculty. 4. Data member for the student Gender (M or F). 5. Data member for the … |
|
Re:
I'm trying to sort an array of numbers in ascending order and don't know whats wrong with my code (I'm completely new to vectors). I should first copy the input array (data) into an STL vector, then apply STL’s sorting algorithm to the vector, and finally copy the vector back … |
|
Re:
[CODE] vector<int> iv; iv.push_back(4); vector<int>::iterator it = iv.begin(); cout << *it; cout << *(iv.begin()); //debug assertion here [/CODE] Why can't I dereference iv.begin() directly? |
|
Re:
//I have this running but when the user inputs a different character than the program just out puts the error //message and that its. I want it to go back and ask the user if they would like to run the program again. Any //ideas? Thank you! [CODE]int main () … |
|
Re:
I'm having trouble writing an array program that deletes duplicate numbers in an array. I can't figure out the code for find the array size. I have the array max set to 25 but my array doesn't have 25 numbers in it. (let's say it only has 10 numbers in … |
|
Re:
Hey guys I'm here again with another problem. I want to search in a string for a string with quotes in it. Example: [CODE]String to search = {' </a></div></div></div><div class="clearfix"><table cellspacing="0" class="wsod_quoteData"><tr><td class="wsod_last wsod_lastIndex" nowrap="nowrap" '} What to search for = {' <table cellspacing="0" class="wsod_quoteData"> '} Then if found, from … |
|
Re:
Using strings [CODE] #include <iostream> #include <string> using namespace std; string replaceSubstring(string, string, string); int main() { string string1 = "the dog jumped over the fence", string2 = "the", string3 = "that", newString; cout << "This program will replace a keyword in a sentence with another word.\n\n\n"; cout << "Our … |
|
Re:
So I have question regarding a program I need to write. I need to read a text file which consists of a location and the coordinates of it's longitude and latitude. The program should be able to read any amount of spaces and tabs in between the tokens. So it … |
|
Re:
Hi everyone! When i compile my small piece of code it gives me the error [COLOR="Red"]C2512 : No appropriate default constructor available[/COLOR] this is my definition of class person: [CODE] // Person.h // A class defining a person #pragma once #include <iostream> #include <string> #include <functional> using std::cout; using std::endl; … |
|
Re:
In my cs2 class the assignment is to implement a sparse matrix with pointers without using a 2d array. Here is the exact text: A sparse matrix can be represented using an array of pointers called "arrayOfPointer" and an array of integer called "matrixInfo". The size of "arrayOfPointer" will be … |
|
Re:
I have two quick questions: 1) What is the point of a static method? As far as I can tell, there is no data there that would be accessed by multiple objects as there is no data stored there at all... 2)What does it mean to have a const after … |
|
Re:
Here is my project: Write a program that dynamically allocates an array large enough to hold a user defined number of structures (string name and three double tests). Using a function, the user will enter a name and 3 test scores for each element in the array. Using another function, … |
|
Re:
Hello. I have a game with code like this. [CODE] class manualSetPosition{ public: Ogre::ManualObject * manualDebugger; void SetPosition( Ogre::ManualObject * manual, Ogre::Vector3 mousepos ){ manual->position(mousepos); }; }; [/CODE] Thats a class I use to draw a grid. I build it like this in my project. [CODE] manualSetPosition ManualSetPosition[1226]; [/CODE]this works … |
|
Re:
Hey1 fox so last weekend my friend asked if i could help her on her Comp Sci project, Little did she know im not a programming genius. So i've come to the one and only Daniweb for help... here's what she's supposed to do.. Write a C++ program by completing … |
|
Re:
Anyone can help me with this algorithm? 1 set up stack in and print it 2 while stack in is not empty repeat 2.1 max = in.pop 2.2 while there are still element in stack in repeat 2.2.1 value = in.pop 2.2.2 if value > max 2.2.2.1 temp.push(max) 2.2.2.2 max … |
|
Re:
Hello again I am a bit confused about how to show a constant in a class constructor. I have a savings account class (A child class of Account) which has a constant interest rate. I have it in my class as a static constant double INTEREST_RATE;. Then outside of my … |
|
Re:
Hello I am creating a bank account for an assignment and the account number must be automatically generated with consecutive numbers. I have written some code that works, but now I need to know how to use it in conjunction with my Account class, especially how to add it to … |
|
Re:
So I'm trying to write a program that is due tomorrow. I am trying to overload operators and dealing with template classes. I have everything written already but keep getting this error whenever i try to compile the driver file: NOTE: proj4.cpp has #include "box.h" and box.h compiles fine, but … |
|
Re:
Hello all, I am trying to figure out how to create new class objects when the user is asked if he/she would like to. What I have is a program we have to write that takes a certain number of students and keeps track of their name, assignments, and the … |
|
Re:
For my intro to c++ class I have to create a complete program from broken algorithms The questions are (a) Print a random number between -1 and -9 to the output screen: (b) Print (to the output screen) the sum of the square roots of the numbers 1, 2, 3 … |
|
|
Re:
Hi everyone just started Daniweb! I have been using devcpp for some time.I am trying to make a switch from DevCpp to Visual Studio but find the latter confusing having so many options. Recently, I did a console application that will accept a word from user and prints its anagrams. … |
Re:
Ok this comes as two questions: what is the best variable for storing bianary data and how would I send That through a XOR gate? When I searched it didn't really do anything because XOR is a binary operator. I remember how to open o file in binary form from … |