Beginners - April 2014 (Page 45)

Can you access elements in a vector using strings?
 
For example, to access a certain element in a vector of classes, you'd write: std::vector<class1> myVector; myVector .update(); but is there any way ...
[5 replies] Last: A vector stores a contiguous sequence of elements. A map stores a uniq... (by LB)
by angelk
combination sums
 
I have a set price within an array, I have to find the best combination of them, which do not exceed a certain amount. Can you give me a hand.
[1 reply] : If I got your question right, then sort the array and take the minimum... (by moshams)
by IBCFQ
Looking for a C++ partner
 
Hello, Not sure if I'm posting in the right section, however I am interested in learning C++ with another person to speed up the capabilities and learning. I...
[19 replies] Last: Lol! Okay (by Senasel)
3 User Defined Funtions
 
So I am taking this C++ course and I am currently dying in it... So help would be lovely. I am supposed to add 3 user-defining functions and at least one of tho...
[1 reply] : I am supposed to add 3 user-defining functions I don't see any func... (by AbstractionAnon)
Cannot run palindrome program
 
I'm trying to compile a piece of code from a c++ book as an example, but I can't figure why it won't compile. #include <iostream> #include "stack.h" usi...
[4 replies] Last: Shouldn't there be a Stack.cpp or something that contains the implem... (by long double main)
substr help
 
Hello, I am quite new to C++ and I just learn about substr. I was wondering if it was possible to use a loop to keep finding a substr for spaces in a sentences...
[1 reply] : std::string::find(). also, if you put it in a string stream then you c... (by Little Bobby Tables)
newton's method to find square root using recursion
 
This question is from my book trying to solve but problem in the code could anyone help/ what's wrong in my code ?? Please help The function sqrt from the heade...
[3 replies] Last: It was my typo error actually, I just corrected it, when you say "co... (by Chervil)
Switches
 
I'm having a problem understanding how switches work, I understand their like if statements, but I can't figure out how to get them to work properly. When I ...
[10 replies] Last: oh oh oh, I see where you are going with it wildblue. Thank you (by football52)
by afdh
Abstract class type not allowed as parameter
 
Hi, I have a abstract base class polygon and want to write a pure virtual function to translate my polygon, however I cannot write 'virtual polygon translate(...
[no replies]
Outputting a character from a stack outputs the ASCII instead
 
I put a + in a stack, and I'm trying to use cout to display stack.top(), which is the +, but it's outputting 43 instead. This isn't my code, but it's essenti...
[1 reply] : because you use int as the template argument ? #include <iostream... (by nvrmnd)
by afdh
Have to enter the input twice
 
Hi, I have written a function to overload <<. The while loops are to check if the input is int or double, and reject it if it is not the correct input. When t...
[3 replies] Last: Thanks, great help! (by afdh)
basic file I/O string issues
 
This is a class project. I am using file I/O to read a file for data. It reads the file but when I cout the string it displays the \n instead of a new line. how...
[3 replies] Last: If you're in an editor (such as notepad), \n has no special meaning. ... (by AbstractionAnon)
City to zip program help please
 
I need help i do not know how to enter the zip and have it display the city vice versa can someone please help me with this? #include <iostream> #includ...
[1 reply] : At lines 98 and 127 you have read a line of text from the data file in... (by AbstractionAnon)
by angelk
console and initwindow c++
 
Hello everyone, I have created a program that uses a initwindow the problem is that when the initwindow is called, the is placed below it. Can you tell me if yo...
[1 reply] : You may have to include the code you are talking about and please be c... (by CodeGoggles)
Not Sure Why It Always Returns -1..
 
This program is supposed to find the largest number, then cout the index it's found in an array, along with the unsorted array. We can use a sorted array when w...
[10 replies] Last: Why does void sort() have a return floating in it? Okay, but what i... (by Mats)
Comparing Two Strings (C++)
 
Objective: Function that takes two strings as parameters & returns if true if same. Right now, I have my code working to compare two strings lengths. Inp...
[15 replies] Last: @CodeGoggles Yea, you dont want to check the characters if the lengths... (by sportstool)
Code Review Needed - Function Causing Core Dump (Code in URLs)
 
Hello C++.com, I'm relatively new to coding (a few months), and I need some help figuring out how to fix this program I'm writing for an assignment. Most of...
[2 replies] Last: I've actually been doing a bit more experimentation, and that isn't it... (by JbstormburstADV)
Program holds during scroll in sub window
 
Hello, I'm working with c++ (ms vc11) with the .Net 4.5 for windows. I have a main form with a main loop which calculate something and display it on the f...
[2 replies] Last: I suppose you could look into threading your program so that other tas... (by CodeGoggles)
Getting unexpected values when trying to set Bits
 
I'm experimenting setting bits to get a feel for how it is done. In this case I want to change the value five to -5 by changing the sign bit. #include <io...
[4 replies] Last: Ok I understand two's compliment now. For anyone else who would like a... (by CodeGoggles)
by pishi
strange segfault in class
 
When i run this code,it gives me segmentation fault. gdb backtrace result: Program received signal SIGSEGV, Segmentation fault. 0x08048821 in block::setcolor...
[3 replies] Last: thanks for your helps guys. i changed code to this and my problem solv... (by pishi)
April 2014 Pages: 1... 4344454647... 67
  Archived months: [mar2014] [may2014]

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