111 Posted Topics
Re: [QUOTE=jwenting][code]string ponter = new string;[/code] [/QUOTE] Shouldn't that be [code] string* ponter = new string;[/code] :?: | |
Hello ladies and gents, I'm trying to include a copy constructor and an assignement operator into this code wich has two separate classes, the idea is to copy the last name that was entered. Problem is, I can't seem to grasp how to get acces to the copy constructor in … | |
![]() | Re: [QUOTE=Geek-Master]Does anyone know of a college in Georgia that offers a complete online BS in Game Development or Computer Science?[/QUOTE] Think you'd better ask that question at the [url=http://www.gamedev.net/community/forums/][COLOR=Red]GameDev forums[/COLOR][/url] ![]() |
Hello ladies and gents, I was trying to write a small example of a pointer to a two dimensional array like this after looking up how to write the syntax at Narue's Et.Conf. world like this: [code] #include <iostream> #include <iomanip> void array(short (*myArray)[4][4]); using namespace std; int main() { … | |
Re: >Do this //Constructor CBooks()[COLOR=Red]{}[/COLOR]; >You hadn't defined the Constructor. Only declared it. And **remove** the semicolon: CBooks(){}; | |
Hello ladies and gents, I was just wondering how you would implement this into C if it actually is possible, if not, how do you guys implement an equal way of dealing with this in C ? For instance, if you would have classes like this in C++: [code] class … | |
Hello ladies and gents, I hope the moderators won't mind me posting this here, if they do, feel free to move it, but since it is related towards C++, I figured it belonged here ;) A while back I was browsing the GameDev forums and I found this thread in … | |
Hello ladies and gents, Wondered if any of you could help me out here, I'm trying to increment an element of a vector of integers. Here's the code: [code] #include <algorithm> #include <cctype> #include <iostream> #include <string> #include <vector> using namespace std; int main() { vector<int> scores; scores.push_back(500); scores.push_back(600); scores.push_back(300); … | |
Re: [QUOTE=kahaj]Narue's site? Where would I find that at?[/QUOTE] Here ya go: The Eternally Confuzzled World of [url=http://www.eternallyconfuzzled.com/index.html]Narue[/url] :mrgreen: | |
Hello ladies and gents, Ive been reading about Virtual Function in my book and there is this programming that shows how and what happens, I understand what is happening but one thing that came to my mind is that, previously in my book, there was mentioned that you should allways … | |
Re: [QUOTE=iamthwee] j++ means j == j +1 [/QUOTE] I think you ment j = j + 1 right :?: | |
Re: [QUOTE=WolfPack] you can also use [code]system("pause" );[/code] statement before the return statement to make the program pause till you press a key.[/QUOTE] I thought Ive read on several occasions that this should be avoided since it is bad programming :?: | |
Re: [code] #include <iostream> using namespace std; int main() { int stop = 0; while (true) { stop++; cout<<"Hello!\n"; if(stop == 5) break; } return 0; }[/code] OR [code] #include <iostream> using namespace std; int main() { int i = 0; for(;;) { i++; cout<<"Hello!\n"; if (i == 5) break; } … | |
Hello ladies and gents, I was reading about how "Passing by References" for efficiency and there was a little program added wich shows what the difference is between passing by value and passing by reference is. The program is this one: [code] #include <iostream> using namespace std; class SimpleCat { … | |
Re: [code] #include <iostream> using namespace std; int main() { char ch = 'j'; while(ch == 'j' || ch == 'J') { cout << "Enter height in centimeters: "; int centimeters; cin >> centimeters; cout << "Your height in feet " << centimeters << endl; cout<<"Wish to enter a new number? … | |
Re: [QUOTE=cscgal]Eternally confuzzled ... my favorite site :)[/QUOTE] DITO :D | |
Hello ladies and gents, I'm reading about the algorithm partial_sum and there are two different versions of this. The first one just calculates cumulative numbers like this: [code] #include <iostream> #include <numeric> #include <vector> using namespace std; int main() { int a[4] = {10, 20, 30, 40}, b[4]; partial_sum(a, a+4, … | |
Hello ladies and gents, Im reading about working with maps and there is small programm example shown in this chapter. Now, when I write this code into the MS VC C++ compiler and compile the code, I get like over 90 warnings, however, when pressing compile again, they all are … | |
Re: Hi Narue, I was just wondering wether you guys ever thought about adding several [B]Post Icons[/B] stating wether the questions is related towards C, C++ or additional on compilers, etc... Probably you'll think that this will be forgotten more then it'll be used, then maybe the forum can be altered … | |
Hello ladies and gents, Have a few questions about the following example that is given: [code] #include <iostream> #include <fstream> using namespace std; int main() { char ch; int n=0; ifstream ff("aa"); if (!ff) { cout << "Can't open file aa for input.\n"; return 1; } ofstream gg("bb"); if (!gg) … | |
Hello ladies and gents, In my book, I'm currently reading about the use of creating your own operators << and >> for in- &output. There's been given a small example that goes like this: [code] #include <iostream> using namespace std; class vec { public: vec(float x1=0, float y1=0) {x = … | |
Hi Narue, Ive started your tutorial on pointers and had a few questions about it if you don't mind. 1) You talked about the fact that a function has an adres itself and that you can call a function threw it's adres. This I understand, as I tried it out … | |
Re: [QUOTE=mozira]... i am doing the program and asking help from fellow C++ geniuses.[/QUOTE] :lol: From fellow C++ geniuses hey, well, there certainly are several hanging around here, but seeing as you even use void main(), I'm certain your not one of them :lol: Don't know about you, but saying to … | |
Re: Maybe better would be to take a look at the list of books Dave Sinkula has made: [QUOTE=Dave Sinkula]With regard to C++ books, I'll just echo the advice [url="http://groups.yahoo.com/group/c-prog/message/37324"]here[/url]. The following books are recommended; read them in mostly the order listed. "Accelerated C++" Andrew Koenig & Barbara Moo "The C++ … | |
Hello ladies and gents, I had to do an exercise in wich I was required to compair two standaardtype strings opposits, meaning: name = "Johan", name2 = "nahoJ" The idea was to return a bool value True or False. I did this with the following code I wrote:[code]#include <iostream> #include … | |
Hello ladies and gents, Came across a program example in wich you are able to sort program-parameters in alphabetical order. The code is this:[code] #include <iostream> #include <string> using namespace std; void sort2(char* &p, char* &q) { if(strcmp(p, q)> 0) { char *h; h = p; p = q; q … | |
Re: Hi, You have made a declaration of your pointer *b, but where is the definition of it :?: A pointer is an adress and must be assigned towards one, meaning, you'll need to use 'new' to assign an adress towards b. Hope this helps. | |
Hello ladies and gents, Ive been reading about how when a class becomes to big due to to many memberfunctions, it is best to split the program up into several sections wich could be something like this: Interface section Implemenation section Application section I was given an example wich is … | |
Hello ladies and gents, Ive been reading about when you have a very large program, that it is advisable to divide this into several modules. Ive tried this out with an example of two separate modules that where given as examples and managed to get two .cpp modules into the … | |
Hello ladies and gents, I'm trying to output a 2D array, but can't seem to find the solution, can anyone help me out here. [code] #include <stdafx.h> #include <iostream> using namespace std; int main() { int **pp; int i, j, n, ni; cout<<"Geef het aantal regels als volgt: "; cin>> … | |
| |
Hello ladies and gents, Wanted to make this part of an exercise in wich I enter each time two integers into an array for wich I have to use STL container vector. Ive got this sofar, but getting an error message when I entered two numbers and the exe shuts … | |
Hello ladies and gents, Ive got a question concerning how to actually send a program to someone (only the exe.file) so that he/she sees what the program can do without having the possibility to alter anything towards the code itself? I'm using Microsoft Visual C++ 6.0 incase you need to … | |
Good evening everyone, This next exercise, I have to do the following: Write a ClassTemplate for a linked list. Demonstrate it by using two linked lists. The datafield of the first type is int, the second one is double. What Ive got sofar is this: [code] #include <iostream> #include <vector> … | |
Hello ladies and gents, I wanted to ask if this piece of code can be written differently then the way I did: [code] template <class V> void sequence3(V &a, V &b, V &c) { V w; while (a > b || b > c) { if (a > b){w = … | |
Hello ladies and gents, Ive got this example of a program that I tried out wich shows some special possibilities to use new. [code] #include <iostream> using namespace std; int main() { int a[100]= {0}; for (int i = 0; i < 100; ++i) a[i] = 100 * i; int … | |
Hello ladies and gents, Ive been reading about pointers abit and at there are two pieces of text in the book about pointers wich aren't clear to me, was wondering if any of you could enlighten me abit about them! :D [quote]Sometimes it's desired to clearly point out that a … | |
;) Hello ladies and gents, Ive written this class time in wich I have to use operator+ to increase the hour with a certain amount of minutes like this: time t0 (23, 59), t1; // t0 = 23.59 t1 = t1 + 120; // t1 = 1.59 Problem is, I … | |
Re: Why go anywhere else if we have people like Narue, Dave, Vegaseat, Asif, ... to ask questions towards, besides, Daniweb has got alot of tutorials aswell :!: | |
Re: Hi, Ever tought about using the Algorithm of Euclides? Example of getting the greatest common devider gcd(1147, 851) Steps: 1) 1147 = 1x851 + 296 2) 851 = 2x296+259 3) 296 = 1x259 + 37 4) 259 = 7x37 Rest equals 0. Then the gcd equals 37. If you can … | |
Hi ladies and gents, Next exercise is the following: Write the function which we can declare as follows: unsigned char bcd (int n); The idea of this function is to store the last two decimal numbers of n into a 'binary coded decimal' byte and to return this value. So, … | |
Re: Hi Acidburn, Don't know if it's correct, but don't you have to write: [CODE]bool Date::testEqual(Date &someDate) { if (Date == someDate) return true; else return false; }[/CODE] :?: | |
Hi ladies and gents, I wanted to start a new exercise, but after reading it several times, I actually don't know what the exercise is all about :!: The translation into English is this: [quote]Write a function wich can be declarered as the following: unsigned int datecode(int year, int month, … | |
Hi ladies and gents, I made this exercise in wich recursion has to be used and it worked as it should: [CODE] void ggd(short x, short y) { short a = 0; if (y == 0) { cout<<"The largest common divider is: "<< x <<endl; } else { a = … | |
Hi ladies and gents, I'm trying the next exercise: Write a function value, wich adds the decimal numbers of 'n' together and return the result of this into main? For example: 0.1234 = 10 0.01234 = 10 0.3286 = 19 What Ive got so far is this: [CODE] short amount … | |
Re: [quote]I also get 2 errors saying: (37) : error C2065: 'max' : undeclared identifier (40) : error C2065: 'min' : undeclared identifier[/quote] It means that in main, these two aren't declared! What are they, integers, floats, an array, ... Out of curiousity; Tough I'm far from a programmer and I'm … | |
Hello ladies and gents, I'm starting on the next exercise, but I'm puzzled a bit and was wondering if any of you might help me with this. I have to enter four integer numbers, non negative and smaller then 16 into ONE variable int x, now, the thing I was … | |
Hello ladies and gents, I'm trying to write this little program in wich I have to enter by keyboard a certain amount of numbers (int) not floating points, and the program must count how many [U]different [/U] numbers I have entered, when the amount is equal to ten, it must … | |
Re: [QUOTE=Acidburn]hello, ok here it goes... I've got a char array but it doesnt want to let me add data to it!! I cant figure out why [php] //skip the program heres the line... int chararry[12][10] = {Jan, Feb....} [/php] but I keep getting an error saying its not been initialized... … | |
Hello ladies and gents, I was making this small exercise in wich I have to enter a certain date meaning, day, month and year. If entered it should count the amount of days from the beginning of that year and print it. I found a solution for this, but was … |
The End.