Beginners - January 2017 (Page 21)

by RezaA
How to write a get function for a 2D vector
 
I am trying to get access a specific variable of a 2D vector in another class using "get" function. However, it is vague for me how to ask the code to select th...
[9 replies] Last: Well picked gunner :) (by closed account 48T7M4Gy)
by RezaA
"Get" function for a vector
 
I am working on an OPP code and I want to write a get function for a vector. I have a vector and each element of the vector is a class and there is a vector i...
[2 replies] Last: http://www.cplusplus.com/forum/beginner/205734/#msg974738 (by closed account 48T7M4Gy)
'i' remains as 33 after executing the destructor
 
Hi The following programme is from a video tutorial. I think/learnt the aim of the destructor is to release the memory of the constructor. Since that, I don't ...
[6 replies] Last: Hi JLBorges, It's very kind of you to keep helping me. I think I (at... (by iclearwater)
I'm not sure if I used the new operator correctly here
 
This is a sequel to a previous thread (http://www.cplusplus.com/forum/beginner/205575/) which involved using getline() with cin.ignore () to store an arbitrary ...
[5 replies] Last: thanks boss! I'll get back to you after effecting the corrections. I a... (by ayoesquire)
tolower
 
Hi, I have been fiddling with c++ and I can't figure out why I am getting the issue with this conversion function. I created a c-string and then copied each to ...
[3 replies] Last: A c-string is an array of characters. But an array of characters isn't... (by Chervil)
valarray size?
 
I am confused regarding the definition of a valarray. The constructor is listed as explicit valarray( std::size_t count ); So I assumed std::valarray<double>...
[1 reply] : You should be using parentheses() instead of the braces{} in your init... (by jlb)
Don't understand : in special members
 
I am doing the beginners tutorial and I have never seen the : operator after a constructor. Can someone explain to me what Example2 (int initial_value) : total(...
[2 replies] Last: thank you, I haven't found this on stackoverflow (by Fajsdie)
"Jumping Into C++".Practice problem.Chapter 7_3
 
I am reopening this topic because the solution to this problem is not complete. When you try to test the related topic code samples you will notice that the pro...
[3 replies] Last: I have modified the code to include the prime numbers into the output.... (by Icyblizz)
basic char int conversion
 
Just to exercise i wrote a function to see if a line input (string checkInt) represents an integer and I'm glad it worked. bool checkIntInput(string & checkI...
[9 replies] Last: Some of your descriptions are ok, though I tend to look at things from... (by Chervil)
c style pointers in c++
 
I am attempting to use c style pointers in c++. I've created a Book class (base) and BookCategory (derived) class. All pointers are initialised to nullptr. A...
[5 replies] Last: Hi Thomas, thanks, I never realised one could create an enum class. t... (by bluefrog)
struct and classes
 
just a simple question, is it possible to do this struct position { int x; int y; } player, object; class map { private : const stati...
[4 replies] Last: doesnt matter now.... thanks for the help though (by Flaze07)
Question
 
cout << (n % 2 == 0) ? -n : n;// how this line of code is working i am not understanding #include<iostream> using namespace std; int main() { i...
[6 replies] Last: > first i also thought this like if and else but output is not same T... (by JLBorges)
Return Array From Function
 
Hi Friends. I wrote a program to pass three arrays to a function and added them. Now i am trying to return the added array back to main function .. i am not get...
[3 replies] Last: Arrays work just like pointers (by bird1234)
trying to use the getline() function after an initial use of cin (1,2)
 
I have been attempting to use the getline() input stream to read a string immediately after reading in a number using cin object, but I noticed that when I run ...
[25 replies] Last: Hello Chervil , I hope you got my mesage. Thank you (by ayoesquire)
sort alogrithm with classes
 
Hi guys, I am attempting the following question: A program is required to register user votes for a number of talent contest candidates. When all the votes h...
[9 replies] Last: JLBorges: as Thomas1965 points out, the compiler supplied ones might b... (by gunnerfunner)
Mp3 Linux Qt5
 
I'm on a linux and I want to get data out of an mp3. Hang in there because I know the first thing you're thinking is "this dope doesn't have his codecs set up"....
[1 reply] : OK, I tried to set up a simple QMediaPlayer, and I got a different mes... (by newbieg)
Overloading Operators
 
Hey there! I'm writing a program that converts the amount of hours input into the number of days. It then uses overloaded operators to manipulate this data, and...
[1 reply] : Nevermind! I'm a dummy and was looking at the wrong increment section.... (by crowdiax25)
How to detect prime numbers?
 
So, I'm trying to write a program where the user inputs an integer, and it determines if it is prime or composite. So far I have made it check if the number is ...
[9 replies] Last: Wow, thanks for all the help! I did it! (by closed account 3vX4LyTq)
Cannot find -liostream
 
Hello. My codeblocks hasn't worked since I turned on the PC today.The compiler literally can't find the iostream library and I don't know why. I gave it the rig...
[1 reply] : What is liostream? (by gunnerfunner)
Search and delete in struct vector
 
Hi everyone! I have been cracking my head for some hours now trying to figure out how to do one part of my assignment. Problem: I have a struct of persons ...
[10 replies] Last: EDIT: Question title edited Sorry for not including the full correc... (by longberns)
January 2017 Pages: 1... 192021222324
  Archived months: [dec2016] [feb2017]

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