General C++ Programming - March 2019 (Page 2)

convert program
 
Can anyone teach me how to convert my code using class. #include <stdio.h> #include <iostream> #include <string> #include <math.h> using namespace std; in...
[3 replies] Last: Shouldn't the inner loop increment up to width ? (by doug4)
by stav17
compiling error
 
I am writing a program trying to convert distance measurements to meters. using c++. error: Undefined symbols for architecture x86_64: "_main", referenced f...
[1 reply] : I think it's just saying that your program does not have a main() func... (by Peter87)
int to int
 
Hey guys. I'm having a problem compiling my code. I'll post my code now. #include <iostream> #include <string> #include <stdio.h> #include <stdlib.h> #includ...
[7 replies] Last: Fixed: arrays have to have a size at compile time. won't do. it see... (by jonnin)
Need help with error messages "LNK2019"
 
Here is my code: #include "stdafx.h" #include <iostream> #include <cctype> #include <cstdlib> #include <iomanip> #include <string> #include <fstream> ...
[3 replies] Last: And if you didn't find the cause of the 2nd link error: displayString... (by deleted account xyzzy)
class BoxOfProduce c++
 
Your Community Supported Agriculture (CSA) farm delivers a box of fresh fruits and vegetables to your house once a week. For this Programming Project, define th...
[3 replies] Last: Line 15: How many strings do you think you're allocating? Why is Box... (by AbstractionAnon)
OOP WITH C++
 
Write two overloaded functions that return the average of an array with the following headers: int average(const int array ,int size ); double average (const ...
[3 replies] Last: roughly, for a vector average: for (auto n : a) avg+= n; avg/=a.size(... (by jonnin)
How can I pass value through a specialized template class?
 
Here is my problem I have an existing no-template class A, currently being used by many places. I want to modify it with minimal impact on the exiting codes, i...
[11 replies] Last: Thank you very much, JLBorges. (by chrisben)
Help with some structures/for loops
 
I am working on a program to make a small library of the ten books I have chosen. With this program I should be able to A) Print the full library inventory (A...
[2 replies] Last: string name; cin >> name; That is formatted input that skips prefix ... (by keskiverto)
by Halken
Roman Numbers
 
I have written the following code, however, I am having issues passing part 1. #include <string> #include <iostream> #include <ctype.h> using namespace st...
[1 reply] : > I've been asked to complete the following class questions. And now ... (by salem c)
Help with converting tolower string
 
Im a beginner c++ programer and I'm trying to use an array but cannot figure out how to get it to work //Parameters: const string input // Returns: string -...
[1 reply] : This is a “prove you have been paying attention in class and reading... (by Duthomhas)
by stav
Templated NonCopyable Singleton class ?
 
Hi i have the following code: template <typename T> class Singleton { public: static T& GetInstance() { static T instance; return instan...
[3 replies] Last: [quote=stav] i get an error on line 7 I apologize for adding a post i... (by Enoizat)
by Deamer
I have python code, I want to chang it to C++. How to di it?
 
img = cv2.imread(image_path) h, w, _ = img.shape mser = cv2.MSER_create(_min_area=100, _max_area=400) gray = cv2.cvtColor(img, cv2.COLOR_BGR2G...
[4 replies] Last: boxes = boxes[boxes[:, 2] > 10] boxes = boxes[boxes[:, 3] > 10] boxe... (by ne555)
FailCheck a Char.
 
So I'm trying to write a fail check for a char data type so that in case a user inputs a word then it will deny it then send an error and ask for another input....
[4 replies] Last: all 3 ideas behave slightly differently. I was going off the idea tha... (by jonnin)
by plexus
Using strings in switch statement
 
Hi, I recently had this idea of how to use strings directly in a switch statement without too much clutter. See below. My question is: is it a bad idea to...
[8 replies] Last: To solve your specific problem, take the easy way: an if..else if sequ... (by Duthomhas)
Going blank after input
 
Currently my program will close after I input my racer's names and time.I was wondering if anyone could tell what I am doing wrong and give me some tips. There ...
[4 replies] Last: or, in beginner speak, conditions are explicit. the compiler does no... (by jonnin)
virtual function
 
Hi, I am learning Virtual function in c++. I read Virtual function is member function that is used to achieve run time polymorphism. It is known that polymorph...
[2 replies] Last: how run time polymorphism(i.e;one name multiple forms) is achieved th... (by keskiverto)
not sure where the error is
 
#include <stdio.h> #include <iostream> #include <string> #include <sstream> #include <fstream> using namespace std; struct student_t { string name; string I...
[4 replies] Last: Does this version give you the same errors? #include <fstream> #incl... (by Enoizat)
Generic function pointer type
 
I am developing a class that needs to store a call back function. So it needs to include a pointer to some “functor” object and a method to initialize this ...
[2 replies] Last: class Thing { std::function<void()> callback; public: void setCallb... (by Peter87)
Creating a class book
 
Hi, everyone I am working on this question. Booker University maintains an inventory of books. The list includes the details: Author,price,title,book_number an...
[2 replies] Last: Line 4 should not have a ; Line 8: author and title only hold a sing... (by AbstractionAnon)
Absatrct class destructors : why ?
 
If I understand well an abstract class needs to have an explicitly defined destructor, correct? At the minimum, this will do: ~myClass(){} But not this: ...
[1 reply] : If I understand well an abstract class needs to have an explicitly de... (by Peter87)
March 2019 Pages: 1234... 9
  Archived months: [feb2019] [apr2019]

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