General C++ Programming - February 2018 (Page 7)

Divisibility by 3
 
I'm trying to write a code for an integer n a) n is less than 500 b) n is positive c) n is divisible by 3 but the result for divisibility by 3 is not...
[5 replies] Last: yeah could work but that will be another code to add individual values... (by briankiprono)
Testing for a character in a string
 
I just had one quick question, is it possible to test for one character in a string? Example of what I mean, test for '-' in the string amount(-22.26) and if ye...
[1 reply] : https://stackoverflow.com/questions/3300743/i-want-to-see-if-a-charact... (by cire)
C++ LOOPING - Lost with homework
 
Create a loop which reads a customer number, customer name, and customer balance from the keyboard and then creates a customer object which it adds to a diction...
[2 replies] Last: it is the first class in C++ programming - everything else has been in... (by brown1z1975)
Tried but nothing coming up. Can you help me with this?
 
55. After following statements have executed, what will be appear on the output window int i=0, a=0; while(i<10){ ​a=a+i*i; ​i=i+2; ​cout<<a<<en...
[1 reply] : What did you try? int i=0, a=0; // i==0 and a==0, are they not? wh... (by keskiverto)
by Thelps
Error on last value of last box of a vector<int>.
 
Difficult for me to explain this one. Have a function that parses a text file. Every time the function finds a match it saves the character number (position in...
[6 replies] Last: Ganado got the right lead... :) Turned out I had specified the int th... (by Thelps)
While working only when std::cout is used
 
I have encountered an unusual problem: I have a while(1) loop that will break after a few iterations, but it doesn't break (the program freezes when it reaches ...
[8 replies] Last: #include <iostream> #include <string> using namespace std; //=======... (by lastchance)
c++ efficiency subject
 
Hi there! This is a subject related to copy constructors and efficiency in C++. The following code snippet shows three functions: 'example1', 'example2' and...
[14 replies] Last: > do you suggest we should rely on this and simply store the return va... (by JLBorges)
by Cp9
do-while condition problem
 
Hello, I have a problem with the do-while loop. When user press incorrect character I would program to keep printing until the user enters a correct character, ...
[3 replies] Last: The value of showType doesn't change. Exactly. That is the problem. ... (by keskiverto)
Structured binding to tuple
 
Just got into some C++17. Anyone know a good way to make a struct into a tuple? Best I got ATM is this pattern (code is bit rough)... https://wandbox.org/perml...
[17 replies] Last: magic_get looks pretty neat! It also offers recursive member iteration... (by elohssa)
Memory Game
 
Welcome to the memory game! Look away from the board and have a helper enter r to randomize the board until they have a random board that they li...
[1 reply] : @random9 Why don't you show us the code you have and the way you're t... (by whitenite1)
get paid to solve this.
 
Give an initial list of candidate classes and responsibilities. Give an initial set of CRC cards. Prepare a set of 3 UML class relationship diagrams highl...
[1 reply] : Putting aside not doing your homework for you, you've left out the act... (by Repeater)
Help with classes.
 
I need help with assignment, this is what my assignment reads: "Define a class called Class with the same data members as the Class structure above. Member f...
[1 reply] : First of all, there is no need for the typedef in line 24. In C++ you... (by doug4)
While loop/ rand()
 
Use a while loop to write a program that calculates the sum of N integers entered by the user. N is a computer generated random number between 5 and 15. Can ...
[5 replies] Last: Why not just post the code you have so far? It is easier for us to co... (by doug4)
Read binary file passed in from command line
 
I need to pass a file from the command line, read the contents, output to console, and create an output file. I have not added the create file section. #i...
[1 reply] : There's a fairly good explanation here (also see the next page). They... (by kbw)
Deserialize binary tree
 
Hello. I'm working on a program that deserializes a binary tree from file Besides what it is doing,my program should also be able to read hexadecimal numbers an...
[6 replies] Last: Thank you very much! (by MirelPasa)
by KB93
Negative integers in a List
 
If you wished to write a function to determine how many negative integers are in a list, without using any loops or recursion, which std function template would...
[1 reply] : std::count_if() . (by mbozzi)
by KB93
Produce a List of Integers Without Loops or Recursion
 
Without using any loops or recursion, how would I write a function getLengths that, given a vector of std::strings, uses std:: function templates to produce a l...
[1 reply] : #include <iostream> #include <list> #include <vector> #include <algor... (by JLBorges)
open cv error
 
i cant figure out what my error is it keeps giving me the error OpenCV Error: Assertion failed ((unsigned)pt.y < (unsigned)size.p ) in cv::Mat::at, file c:\open...
[4 replies] Last: if (x < mp.cols) { //... image.at<Vec3b>(Point((mp.cols / 2)+x,... (by ne555)
by a10e29
I suck at typedef naming
 
Hello, I was following the call stack, to figure out where things had gone terribly wrong, when I came across this variable named section. Section of what?, ...
[1 reply] : It sounds like you already understand that type names should be meanin... (by helios)
by recuva
Problem with struct data type
 
Hello, I need to do some make few programs with data structures. Problem is that everytime I try to execute my written program code blocks crashes. I tried to l...
[5 replies] Last: Hey, I found the problem. There was wrong character in folder's name :... (by recuva)
February 2018 Pages: 1... 56789... 11
  Archived months: [jan2018] [mar2018]

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