Beginners - June 2015 (Page 20)

by i9try
SORT LIST OF OBJECTS
 
How can I sort a list of objects by using a variable inside the class? #include<iostream> class DateTime { private: int year; int month; int day...
[5 replies] Last: calculate it using your other variables. Edit: oops sorry i re-read w... (by mutexe)
by fdsgjj
Counting prime numbers
 
#include <iostream> using std::cout; using std::cin; using std::endl; int main() { int maxN; cout << "Enter th...
[1 reply] : You have the right idea. You can speed it up by lowering the loop limi... (by dhayden)
by zecbmo
Object does not name a type. Declared in the same header
 
So I have created a class. And declared an array of objects based on it. When running the program I get the message "room does not name a type" I have no...
[1 reply] : You need it to be in main. lines 28 and 30 shouldn't be floating aroun... (by mutexe)
Reversing Arrays Using Recursion
 
Is there a way to reverse an array by ONLY passing in the array? It seems that it is pretty easy if both the array and the number of the elements in the array a...
[4 replies] Last: @cire I understand. Thank you so much! Best regards, Jae Kim (by jhykima)
by i9try
iterator: end-1
 
how can i find the iterator end-1? I want this one: list<Athlete> athletes; list<Athlete>::iterator athl; for(athl=athletes.begin();athl!=athletes.end()...
[1 reply] : use the condition athl<athletes.size()-1 instead of using iterators... (by mutexe)
by Diedes
coupling an int and string together in a node, linkedlist
 
Hey, What this program does (the main), is read a txt file and create a node for every line with a for loop. For example line1 line2 line3 They are all ...
[no replies]
write a matrix
 
Write your question here. how can i write a matrix of size m*n? have just started learning c++.please help me with this..
[1 reply] : http://www.cplusplus.com/forum/beginner/42045/ edit: it's good manner... (by mutexe)
What is going on in this program?
 
Can someone please give a trace/breakdown of whats happening in the program below? #include <iostream> using namespace std; void increment_all (int* s...
[12 replies] Last: Thanks, but I think I already understand that now. I even replaced l... (by Arslan7041)
3d game programming
 
I'm not a complete beginner to c++, i do know the language fairly well. I want to make a retro looking 3d game with it, and i'm not sure how to combine the lan...
[1 reply] : Download the engine SDK and look through the documentation - if you k... (by Codermik)
Writing the command for getting the average of three numbers.
 
Hi guys, so this is what I've been working on. Our assignment is to write a program that the user will enter his 1st quiz, 2nd quiz and 3rd quiz, then after the...
[1 reply] : Try putting your code in code tags. The current program wouldn't com... (by Codermik)
by Ch1156
Why cant I pass this array to the function?
 
I am making a small console game and I made the map, and an working on putting things into functions and classes buit this wont work for some reason, i get this...
[8 replies] Last: How does this output the map? It does produce exactly the same outpu... (by keskiverto)
C++11 move semantics
 
Hello forum, I think that the C++11 move semantics only applies to the class that has member with of dynamically allocated memories. Is that right ? If ther...
[2 replies] Last: > If there are is no member of the class has pointer type & reference ... (by JLBorges)
by Winsu
strange output
 
According to my code I was expecting to have the option of entering the variable sex..but in somehow It's skipping it...I dont know why...there will be somethin...
[2 replies] Last: @rafae11, you should always add supplementary explanation to your ans... (by shadowCODE)
I don't know whats wrong with my code.
 
my code gives me a runtime error "vector iterator not incrementable" here is my code and I'm pretty sure the problem is in the first function but I can't put...
[4 replies] Last: You do advance the counter whether you erase an element or not. That ... (by keskiverto)
switch, constant expression
 
I have declarated this: const int peasant = 300; const int footman = 900; const int archer = 500; const int griffon = 1500; const int hero = 1...
[6 replies] Last: It would probably help if you showed the complete class definition and... (by jlb)
Help with string array?
 
Your program compiles cleanly (at least the second copy of it). What help do you need? PLEASE USE CODE TAGS (the <> formatting button) when posting code. It m...
[no replies]
by Winsu
Inheritance
 
I have a base class, and two derivaded class from that one...what I want to do is to have a class which inheritance everything togheter....the base class and t...
[5 replies] Last: my idea is that GRADUATE person is somebody who is student while he i... (by Winsu)
cin.get proplem
 
HELLO THERE i used this code to assign variable form user input and show what he entered int a = cin.get(); cout << a <<endl; int b = cin.get(); cin.get...
[4 replies] Last: You may want to use your favourite search engine and search for "ASCII... (by jlb)
Using dynamic array function but can't figure out size
 
I know that a vector would solve all of my issues, but the chapter is on pointers and I have to make a dynamic array. The getSalesList function works as it shou...
[6 replies] Last: Wow. I attempted that before even posting the question, but my syntax ... (by D0CHollywood)
std::map
 
This is my first time to use std::map and it wasn't very successful. Could somebody help with this code: enum Units { Peasant, Archer, Footman, Griffon, Hero...
[8 replies] Last: C++98 is not a compiler. It is the first official C++ standard. It se... (by keskiverto)
June 2015 Pages: 1... 1819202122... 32
  Archived months: [may2015] [jul2015]

This is an archived page. To post a new message, go to the current page.