Beginners - August 2017 (Page 5)

Accelerated C++ 8.6 exercise
 
Suppose that m has type map<int, string> and that we encounter a call to copy(m.begin(), m.end(), back_inserter(x)). What can we say about the type of x? What i...
[7 replies] Last: Peter87, thanks a lot for your kind explanation. Your answer is indeed... (by Enoizat)
Trying to make a settings library
 
I am working on a library that allow settings to be easily stored in a file and easily accesed through functions, values and names. The format I chose is this: ...
[7 replies] Last: I already considered something very similar where the filename was p... (by Thomas1965)
Error C2109. Probability Density Function
 
Hi All. I'm a newbie in C++. I want to change the function of probability density function from Gaussian to Kernel(Opendtect). But, I have got an error, "Err...
[1 reply] : The problem is that nowhere in your code have you defined any array va... (by jlb)
I"M A NEWBIE...help me
 
Why is it allways says "WRONG" at the firsttime eventhough i write the correct password...help me:) hjx hjx. #include<iostream> #include<cstring> using...
[19 replies] Last: > this argument depends on the personal opinions.... Yes. > is it o... (by JLBorges)
What's the use of making instance variable private if we compile the program?
 
Hi. Why use private variables inside a class? If the program compiled so, it isn't the same if they public or private? I don't mean a library I mean a complete...
[9 replies] Last: Appreciate your informative comments, thanks. (by omer123)
WHY DOES IT ALWAYS SAY "A"...I NEED IT SAY "OK"
 
#include<iostream> using namespace std; int main(){ system("color e9"); bool a=true; int x; cout<<"x= ";cin>>x; while(a){ ...
[6 replies] Last: could you tell me more details about why would we should use "char arr... (by phongvants123)
by i73
Understand multiple inheritance constructors better.
 
I'll show the code first: class A{ A(string name){ cout << "I am: " << name; } } class B : A{ B(name) : A(name){ } } cla...
[5 replies] Last: I'm dumb, I was creating an instance in my B class of A... Everything ... (by i773)
UVa 127
 
Hi, here I've coded the solution to UVa 127: https://uva.onlinejudge.org/index.php?option=onlinejudge&Itemid=99999999&page=show_problem&category=&problem=63&mos...
[2 replies] Last: Hi, in the parts of the code (detection if card has a move) while(1)... (by oldspiderdude)
by Bopaki
Getting an error on a generic Function template
 
When I compile this exercise20 program I get these three errors: 15 45 C:\Dev-Cpp\SavitchChapter18\Exercise20.cpp 'template<class ForwardIterator, class T>...
[2 replies] Last: Thank you Thomas1965 It worked fine after deleting all those lines. (by Bopaki)
Anyone knows why it din work
 
I try to write a code for sales and profit. profit is 10 percent of sales. and sales is 10 million . Every year, it lose 4 percent of its sales and show the nex...
[5 replies] Last: Ya, you are right, integer division that cause the problem. Thanks a l... (by teopeishen)
Sams Teach Yourself - codes from book doesn't work.
 
Hello. I've just started my c++ learning. I've bought book called "Sams Teach Yourself C++" 8th edition and codes attached to book by publisher... doesn't work...
[4 replies] Last: It does have c++14, tough i personally prefer using Atom as my IDE, lo... (by masecla33)
srand producing same random number every function call
 
I'm writing a program to create a hash table but the hash function keeps giving me back the same number no matter how i write it making every insert in the same...
[5 replies] Last: It's for a data structure class so we have to write each function for ... (by kingkush)
check if a value is odd and print odd numbers
 
I need to write a function that print the value of a given vector. The value of left is 2 and the value of right is 5. Input [2 5 ] Output [3 5] vecto...
[5 replies] Last: vector<int> oddNumbers(int l, int r) { vector<int> result; // crea... (by mbozzi)
Array sum noob problem
 
I'm working on a problem from the C++ primer plus (5th edition) book, more specifically, chapter - listing 7.5 The problem is that when I try to sum all the a...
[4 replies] Last: Not very related but... You should put: using namespace std; This i... (by Chervil)
Read user input, output relevant message
 
Hi, I am trying to create a program that reads one-word user input and outputs a relevant message. What I have so far can only read one word and give one respon...
[1 reply] : I need it to have a bank of words it can recognize and a relevant mes... (by gunnerfunner)
display content of array from function call
 
I want to display the contents of array arr . Whenever I try to, I get funky out of bound negative values displayed where I have the values stored from the payR...
[6 replies] Last: @codewalker, @TheIdeasMan Thank you for your input. This is not a cla... (by PopRockCandy)
Passing pointer crash my program
 
So I'm trying to make elements from an array know about their neighbors, so they can interfer with each other. Here I initialize them: for(int x = 0; x...
[11 replies] Last: Well I found the mistake, CheckForBounds, was glitched out because of ... (by DirtyBlasion)
RayCasting - sphere, plane and OBB
 
I have a problem understanding how excatly the intersection test when testing ray against plane, sphere and OBB. I have a presentation of an assignment and I ne...
[no replies]
Why can't my function work the same way as a 1d array?
 
My question is why can't my program work the same way without 100 100 #include <iostream> #include <string> #include <cstring> using namespace std; ...
[6 replies] Last: Still thank you and it's ok. can you recommend any other ways for the ... (by stonedviper)
Doubt related dynamic memory allocation
 
Please tell me the difference between following codes: - Because both time I got Same OUTPUT i.e "How are you". then What is the use of malloc function? 1...
[2 replies] Last: While we're here, void main() is just plain wrong. main returns a... (by Moschops)
August 2017 Pages: 1... 34567... 17
  Archived months: [jul2017] [sep2017]

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