General C++ Programming - January 2018 (Page 2)

Which C++ library is prefect in solving non-linear set of equations with complex roots?
 
Hi I am developing a small kinetic Monte Carlo code to study atomic evolutions in a material and need to solve several linear and non-linear equations with a hi...
[4 replies] Last: or you could take the =0 away and try to see if you can solve them to ... (by jonnin)
De-referencing of heap object - is there a leak?
 
Is this code safe in terms of memory leaks? And if yes, why? class A { int value; public: A(int value) : value(value) {} virtual ~A() { ...
[2 replies] Last: to be fair, simply making getA return the correct pointer type fixes i... (by Cubbi)
Need to Delete letters in array that are repeated, having trouble with function
 
SO I'm creating a function that takes in a char array to make a 10 letter "word". Then, I need to delete any repeated letters and return it. How would you go ab...
[4 replies] Last: #include <iostream> #include <algorithm> #include <set> using namespa... (by lastchance)
Eclipse program crashing when connecting to MySQL Server
 
I am writing a simple program in Eclipse CDT to connect to a MySQL Server hosted locally. I have ensured the server is running. The code I am trying to execute ...
[2 replies] Last: I have checked this for the driver variable and it is not a null ptr. ... (by cryomick)
Object that is passed by reference isn't updated from original reference
 
Here is the code that confuses me #include <iostream> class A { int value=10; public: void setValue(int value) { A::value = value; } ...
[5 replies] Last: Thank you for this informative discussion @afedorov and @JLBorges. (by kindgnice)
by halfs
How long should it take a mid-level C++ programmer to write a TicTacToe program?
 
Some jobs require a variety of skills. If I am tested in an interview to write a TicTacToe program with some online website platform, how long should it take? ...
[3 replies] Last: > If I am tested in an interview to write a TicTacToe program with som... (by JLBorges)
by xfbs
C++ Iterators what am I doing wrong
 
Dear Members, I have some issues with the C++ iterators. Coming from some other languages, I am used to syntax like: let numbers = vec![2, 3, 4, 5, 6]; let s...
[8 replies] Last: One big advantage of these iterator adaptors is that it reduces the nu... (by mbozzi)
by kada17
Segmentation fault when trying to sort strings from a text file.
 
I am trying to make a function that takes strings from a file as an argument and sorts them using another function. What happens is that the function looks at t...
[4 replies] Last: Actually, it was a silly mistake on my part. I have fixed the problem ... (by kada17)
Infix to postfix expression conversion
 
https://i.imgur.com/qyTSQ3X.png Link have code and bad out put pic. ( and ) seem mess things up and not sure how else to handle. Any help appreciated.
[1 reply] : I don't understand why you take a picture of the code instead of posti... (by Ganado)
by Rafiz
Mother-Class to controll objects, inheritance problem.
 
I want to ask for "rightness" of some idea. Actualy I already used it. While learning SDL I made set of methods, and vector to ensure at any point I can delete ...
[5 replies] Last: Oh, I see. Didn't realize the thing about <cstddef>. But I am still on... (by Ganado)
A code about calling, initializing vectors and classes
 
Hello professionals, I am currently reading some articles about vectors and I came across to this code: template<typename T> class Vec3 { public: ...
[16 replies] Last: Thank you very much @JLBorges, @Peter87, @dhayden for always sharing y... (by kindgnice)
Delete pointer of a class with pointer variables
 
What will happen when I execute following program? class A { int value; public: A(int value) : value(value) {} }; class B { A *a; public: B(...
[4 replies] Last: There is no separate memory allocation or deallocation for non-static... (by dhayden)
Converting a Greek string of letters to all lower case
 
So, I am trying to code a console program in Greek, and since I want to make the input non case sensitive, I wanted to create a function that converts all Greek...
[no replies]
by eraggo
Minesweeper done in main() using SDL2
 
I was having fun time challenging myself to do minesweeper game yesterday and today with SDL2 and having every piece of code in main(). Here is result. (OK; Th...
[no replies]
by NG99
c++ problem 2
 
#include<iostream> #include<iomanip> using namespace std; int main() { int x=2; if(x=0) cout<<"x is 0"; else if (x=1) cout<<"x is 1"; else if(x=...
[3 replies] Last: thank you. i understand (by NG99)
by NG99
c++ problem
 
#include<iostream> #include<iomanip> using namespace std; int main() { int i =8,x=3; switch (i % 2 ? 0:1) { case 0: x/=2; case 1: x+=3; ...
[3 replies] Last: thank you your explanation. i understand. (by NG99)
Limited attempts error?
 
#include <iostream> #include <string> int main() { int number = 1232; int number2 = 2143; int numb; int attempts = 0; ...
[4 replies] Last: I just said edit your post instead of double posting. I'm not sure ... (by Ganado)
Attempting to define 2 different default constructors depending on template type
 
Hi, I want to define 2 default constructors one for each type of the template parameter CharT with the following code: template<typename CharT> class ...
[5 replies] Last: > if in each instantiation only one of the 2 functions would be instan... (by JLBorges)
C++ for beginner
 
Hi all ....new here and new to c++. New like now learning everything ..just completed the hello world...doing some variables and strings now. I am doing self ta...
[1 reply] : welcome! This isn't much of a social site, more of just a Q & A board.... (by jonnin)
C++ Btcn help
 
hey guys, I was wondering if anyone knew how to write a simple programme on bitcoin and how it works, such as hashes, Blockchain, transactions, private keys a...
[11 replies] Last: They are different, but nonetheless you can compare them in their appl... (by Ganado)
January 2018 Pages: 1234... 10
  Archived months: [dec2017] [feb2018]

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