Beginners - June 2020

Menu with switch creates loop
 
Hello, I am new programming and I have a problem that I cannot solve. I am making a menu with switch with void functions so that they only print a message when ...
[1 reply] : #include <iostream> #include <stdio.h> #include <stdlib.h> using nam... (by againtry)
by Mif
Please help with List View..
 
Why do I get this Error.. when this code was copied from MSDN why do they write something that doesn't work? ||=== Build: Debug in ListView (compiler: GNU GCC ...
[4 replies] Last: ohh... ok ok I got it :) Thank you so much.. (by Mif)
Implementing Set in C++ without using STL
 
Hello, I want to Implementing Set in C++ without using STL. I don't have problem with implementing. I don't understand the concept. I don't know how can ...
[3 replies] Last: Read this: http://www.cplusplus.com/reference/set/set/?kw=set A simp... (by coder777)
Buffon Needle Experiment
 
I'm doing a text book problem where we simulate PI using the "Buffon Needle Experiment" and I can't figure out what i am doing wrong. The problem says you need...
[1 reply] : Do you know what a debugger is? Now is the time to find out what debug... (by salem c)
Why is reverse() directly usable without std:: prefix?
 
Consider this code snippet: live demo: http://cpp.sh/5mymy #include <vector> #include <algorithm> int main() { std::vector<int> v {1,2,3,4}; reverse...
[5 replies] Last: Very helpful links, many thanks! (by Jens Hirschmann)
A Cplusplus program to calculate mortgage
 
Hey guys! Im trying to write a program to calculate a mortgage and i got most of it but i am stuck on the actual problem solving. When i run through the practic...
[4 replies] Last: Thank you so much soapbar and lastchance! and thank you for being so k... (by applehoney)
Passing list reference to other function
 
Hi all, int main(){ list<int> list1 = {1, 0, 0, 1}; for (auto& elem : list1) xor1(1,elem); // Identifier elem is undefined. How to pass the li...
[1 reply] : http://sscce.org/ Your random lines taken from whatever code you have ... (by salem c)
C++ varies between complier?
 
I want to know if C++ language varies when you used different compilers or IDE? Or C++ is the exact same syntax and language whatever compiler and IDE you use? ...
[14 replies] Last: You can always stick with standard C++ and generate some SVG graphics ... (by lastchance)
by medosz
Displaying recursion steps.
 
I would like to print the local variable and the recursive call parameter for each recursive call. Cout is not a return type so I can not use it in this return ...
[2 replies] Last: #include <iostream> #include <iomanip> using namespace std; templat... (by dutch)
by Mif
How to create a TreeView and a ListView
 
Hello.. Does anyone knows how to create a treeview or a listwiew ? I read on MSDN but they doesn't provide enough information, I took the example they show ...
[3 replies] Last: I see them all.. the problem is that any of these examples is bring in... (by Mif)
weird output
 
I'm trying to solve this problem https://codeforces.com/problemset/problem/1360/C. Here is my code: #include<bits/stdc++.h> #include<math.h> using namespace...
[3 replies] Last: #include <iostream> #include <sstream> using namespace std; istring... (by dutch)
by sturk
Flip coordinate system
 
Hi how do I invert the coordinate such that (0,0) is at the top. My code treats (0,0) as the bottom. What do I flip in the code specifically? When I flip the Y-...
[2 replies] Last: Thanks. But still really unsure how to do. I tried to take point y and... (by sturk)
Iterating over the keys in map without using boost library
 
Hi, I aware of iterating both keys and values in maps.But how to iterate the map keys in c++ without using boost library. python: for key in sorted(dict_1.ke...
[5 replies] Last: Thank you all for the replies. (by Shruthi LS)
ERROR : narrowing conversion of ‘1952541746’ from ‘int’ to ‘char’.
 
Can anyone help me debugging this code snippet. Thank you! #include <iostream> #include <tuple> #include <map> #include <list> int main() { s...
[12 replies] Last: Yes. Thank you so much. (by Shruthi LS)
Second iteration of function call not behaving...
 
Trying to relearn C++ and started with this simple program. Data capture works as expected the first time, but if I trigger the DO loop by answering "no" to the...
[2 replies] Last: Awesome! I am tracking almost everything you did. Few questions. bool... (by jbhomer)
by sturk
Scaling an image
 
Hi, So i have a background image that I want to scale. My bitmap image is 640 X 240. And I would like to scale by a factor of 2 to get a result of of 1280 X 4...
[2 replies] Last: Mmm lets take this example, how do I scale it up instead of down? I kn... (by sturk)
What's happening in a for(auto& : container) loop?
 
I'm reading which contains this snippet of code demonstrating the Specification design pattern: struct BetterFilter : Filter<Product> { // Filter method...
[12 replies] Last: @mbozzi Cheers, thanks for your always excellent advice :+) (by TheIdeasMan)
Extract specific data
 
I am trying to extract data from a txt file. the file has 16 columns and 10 rows. I need to read in the first 4 columns as they are, then use the last 12 column...
[9 replies] Last: Awesome!! Thank you! It works, I was just asking the TA if I could re... (by Fayezilla)
Trying to make my own strcmp function in C
 
Trying to write my own strcmp function that will take two const char arrays and check to see if they are equal if they are equal it will return 1 if its not i...
[11 replies] Last: When you get to the end of str1, you return true, even if str2 still h... (by dhayden)
No instance of overloaded function error
 
Hi all, I am new to cpp programming. I want to create a map with key as tuples and value as list. And trying to insert the same to the map.But it's not working...
[3 replies] Last: mp.insert({{1,0,1,0},{1,0,0,0}}) this is working. Thank you! (by Shruthi LS)
June 2020 Pages: 123... 12
  Archived months: [may2020] [jul2020]

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