General C++ Programming - September 2019 (Page 3)

take argument from command line
 
EDIT: I have made it get my 2 numbers, but now it will not do any of the calculations. Updated code. I have a project that I cannot finish because I do not know...
[3 replies] Last: [quote=EllMickey]When ran, it will come up as: ./assign1105 and thats ... (by lastchance)
Withdraw numeral amount
 
Hey, everyone, I am trying to create a code that outputs a certain amount of money but can't be less than 1.00 or more than 300 dollars. For some reason, it's n...
[2 replies] Last: Thank you! That was very helpful! (by hendrix33)
Multiplication with linked list hw
 
I'm trying to finish a hw where one of the requirement is a method that takes in two linked lists, multiply them, and return the result in another list. This is...
[4 replies] Last: Your carry calculations are too complex. carry = value / 10; Use -- ... (by dhayden)
Algorithms in C++ example_06
 
Can anyone explain a bit closer to meg what does the function roterVenstre()do, or actually how does it do it, I understand that it moves it back to what it was...
[1 reply] : void roterVenstre(int a , int i) { // Roterer elementer mot venstre. i... (by jonnin)
Algorithms in C++
 
I am reading the book algorithms in C++ from Robert Sedgewick Page 112 about Distribution Counting is this code for (j = 0; j < M; j++) count = 0; for (i...
[1 reply] : count[a ] a is being used as an index into count. lets take a simple... (by jonnin)
Program that converts a month and a date to a day of the year.
 
I have to modify the code below to make it work, so when the user types in a month and a date, it converts it into a day of the year. Example; (mm,dd)= (2/1) = ...
[1 reply] : If you ignore leap years, its a fixed computation. make a lookup tabl... (by jonnin)
Why does forward need a remove_reference?
 
Hi, Looking at the definition of std::forward, I do not understand why it is necessary to specify a remove_reference_t in the first and only argument, like s...
[1 reply] : See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3143.html... (by Cubbi)
by nre17
when i run it it reads the abort line.
 
//Nicholas El Habr //201800512 #include <iostream> #include <cstdlib> using namespace std; int main(int argc, char** argv) { if (argc != 3) { cout << ...
[1 reply] : Are you aware of how to pass command-line arguments? Open the directo... (by Ganado)
In C++ how to call Windows "Disk Management" and wait until it is closed (completed)
 
I'm using Visual Studio 2019 Community. I'm trying to call the Windows 10 program "Disk Management" (diskmgmt.msc) and wait for it to be closed before continu...
[9 replies] Last: [quote=tigerlcf]cmd /c start /wait diskmgmt.msc Works like I want it t... (by Ganado)
Conflicting data types messing up output
 
I am trying to split binary values into an istringstream and calculate its decimal equivalent into the total. void isEven(std::string op) { int number;...
[2 replies] Last: My apologies, I don't know why I went ahead and overcomplicated the ma... (by ddrackley1141)
Expected primary-expressions before 'int' errors
 
Whenever I try to compile and run the code I get an "expected primary-expression before 'int'" error on lines 9 and 21. #include <iostream> using namespace s...
[2 replies] Last: > fill_array(int array ); You only need name the array in question... (by salem c)
Parsing data slow in Windows
 
I've posted here recently about reading from a text file and parsing into a vector. I've noticed, after running a few tests, that the reading of the file is not...
[17 replies] Last: Your file is literally a list of numbers (integers and floating points... (by Duthomhas)
Design in C++11/14/17
 
Dear experts, I suppose that there exist proper design beyond conventional object oriented programming (c.f. GoF design pattern) in C++11/14/17 which enable ...
[9 replies] Last: Dear Niccolo Thank you for your telling great strategy, I keep in min... (by Mitsuru)
by Odglog
Are there any cross-platform console APIs?
 
Hello So I made a text-based game in the console, I used some Win32 API magic in order to do some of the magic (e.g. reading text from the console, setting the...
[9 replies] Last: Thank you so much for the help! :) (by Odglog)
Overloading question
 
Hi, I have the following 2 overloaded functions: void f(int&& x) { cout << "f(int&&)\n"; } void f(const int&& x) { cout << "f(const int&&)\n"...
[5 replies] Last: I got it. In the sample where an instance of X has a lock to be releas... (by JUANDENT)
C++ Extensions
 
Rob and Jason are joined by Miro Knejp. They first discuss a blog post from Tanker covering their strategy to successfully use C++ for cross-platform mobile dev...
[no replies]
by lexa19
When to dynamically allocate objects?
 
Hi! I am new to this forum and to C++ programming, which I fell in love with :). My question is....In software development, when do you need to create dynamic o...
[15 replies] Last: thx :) (by lexa19)
Program Ends Before I get chance to input.
 
#include <iostream> using namespace std; struct bessie { int speed; int time; } a ; struct elsie { int speed; int time; } b ; int m...
[5 replies] Last: int diff ; int aposition ; int bposition ; Your default... (by salem c)
Exception thrown using references, but it's fine with pointers
 
Hi. Here is a function that returns a list starting from a tree using the InOrder traversal method template<typename type> std::list<type> tree<type>::to_li...
[4 replies] Last: you are invoking undefined behaviour. your foot is bleeding because yo... (by ne555)
Replace Words or combinations in a string
 
Hey everyone, I am trying to replace any word in a string with another. The following code works for single characters, but I can't get it to work for words a...
[12 replies] Last: Regex would make this trivial. Use a regex to find all instances to re... (by Duthomhas)
September 2019 Pages: 12345... 7
  Archived months: [aug2019] [oct2019]

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