Click here to Skip to main content
15,893,588 members
Everything / Programming Languages / C++14

C++14

C++14

Great Reads

by honey the codewitch
GFX is a fast and full featured replacement for standard IoT drawing libraries that is optimized to reduce bus I/O
by MehreenTahir
This article will show you an alternative way of using C++; How to write functional code in C++. You’ll see how to write more concise, safer, readable, reasonable code.
by David Lafreniere
A C++17 standards compliant delegate library capable of targeting any callable function synchronously or asynchronously
by Petrov Vladimir
Compact and simply Vector Formula of the Intersection Point of Two Line Segments

Latest Articles

by Bruno van Dooren
Ways to enforce an interface contract on static methods, similar to what you would expect from static virtual methods if they'd exist in C++
by David Lafreniere
A C++17 standards compliant delegate library capable of targeting any callable function synchronously or asynchronously
by honey the codewitch
Take advantage of the PlatformIO repository to easily add GFX to your projects
by honey the codewitch
A more in-depth guide to creating drivers and other custom draw targets for GFX

All Articles

Sort by Updated

C++14 

9 Jan 2019 by #realJSOP
0) I am unfamiliar with the type you're using - unsigned long long int. 1) The variables n, sum1, and sum2 should ALL be ulong values (or at least all the same integer type). 2) You say it fails when you use "large numbers". In what way does it "fail"? 3) Since you're doing math, I'd consider...
5 Nov 2019 by #realJSOP
0) Nobody here is going to go to an unknown website to look at your code. 1) My guess is that the file somehow got corrupted during the "download" process. 2) You can place the files in "the folder", and see if your program will open them.
7 Sep 2020 by #realJSOP
When your app starts, get the current working directory, and before the app terminates, set the working directory back to that saved path.
10 Oct 2019 by 10xlearner
This is a post about my first open source contribution.
23 Jan 2020 by 10xlearner
Memory Management, more specifically in C++
21 Jun 2018 by 11917640 Member
I need a way to manage a date, including milliseconds: get current date and time, add given number of milliseconds to it. The first part is completed. C++ version up to C++14. Thanks. Update: some background. I have a file with timestamp in the beginning, and number of records, each one...
10 Nov 2018 by 11917640 Member
Int64 localp = RerturnLocalPlayer();
26 Jul 2021 by 11917640 Member
Hypothetical copy constructor with non-reference type, such as A(A); requires the copy of its argument. Well, how class instances are passed by value in C++? Using copy constructor. What copy constructor? Obviously, not the same one, this...
14 Jan 2020 by _Asif_
It's easy and a good example can be found here Visual C++ Enable Console - Stack Overflow[^] Do a little search and you will find plenty of examples more.
1 Oct 2019 by Aarti Meswania
Hello mutasadiq iqbal Your question is not probably one which can be resolved as it's lengthy code and we do not know what the exact data all the involved variables holds. But let me provide a guideline, 1. please debug your code carefully 2. check value of "b" variable, it might be not...
4 May 2020 by adityarao31
RETCODE rc1 = SQLDriverConnect(m_hConnect, hWnd, (_TUCHAR*)(LPCTSTR)sConnect, SQL_NTS,szFullConnect, sizeof szFullConnect, &avail, prompt); In above statement of C++ code szFullConnect is suppose to return connection string which is utilised...
13 Aug 2019 by Advik Raj
According to my logic, I think it is possible to convert one language to another, without a transpiler. C code: #include int main(){ printf("Hello, world!"); return 0; } 1. I have converted C code into Assembly code using MinGW (GDB) in CMD. This C program is a simple Hello-World...
14 Aug 2019 by Advik Raj
so, I have this asm code with me and i wish to use it inline with c++, (a combo of asm and cpp) i have seen many links for this but none answer how to do this, the asm code is below .text .def ___main; .scl 2; .type 32; .endef .section .rdata,"dr" LC0:
11 Feb 2016 by Aescleal
The short answer is you can't - std::vector has severe problems with references, it was designed to hold values.So what you need is something that looks like a reference to an int but is actually a value. Something like...class int_ref{ public: int_ref( int &ref ) : ref_( ref...
19 Feb 2016 by Aescleal
The first rule of C++ standard library use is grab a vector and use that. Only if that's too slow (or you don't have enough contiguous address space) do you bother reaching for another container.So try std::vector> stirred with a judicious use of std::sort and std::find to...
10 Oct 2015 by Afzaal Ahmad Zeeshan
Having a C program source code is not enough, you need to have a compiler too. Then, compiler would need the references (locations) where to find the headers (if there are any in the source code). Those headers need to be accessible by the compiler, to link them and create an executable. So,...
10 Oct 2015 by Afzaal Ahmad Zeeshan
Do not repost the questions. They will not help you get the solution. You can improve your own questions to make them "sensible". If the problem was able to get solved, that easier, I'd provided you with the answer in that post. The solution is in the hands of your teacher, why did he give...
30 Sep 2017 by Afzaal Ahmad Zeeshan
There are a few things, you are not using the rect object anywhere. Why? Isn't that supposed to capture the box bounding the found person? The rect which you will detect, will be used to render the box around the person. I wrote an article covering this aspect, but I was working with faces. So...
22 Oct 2017 by Afzaal Ahmad Zeeshan
Chances are that you won't be able to fix this problem, and even if you did try, you will end up with other build failures. The quick solution would be to contact the team/developer who wrote the code and ask them for the latest version of source code; or even better, to get the built binaries...
11 Apr 2018 by Afzaal Ahmad Zeeshan
Firstly, are you sure these are the only lines of code in the file? If this is the case, then consider checking what C++ compiler does JUCE support (and check whether the compiler you have is compatible with that JUCE version, or whatever), as I have not yet checked that. Perhaps it is JUCE that...
7 Nov 2018 by Afzaal Ahmad Zeeshan
If you want to use C# because, then you have to leave all that pointer luxury with the C++. The core concept of C# was to enable you to have a managed environment, where you only had to write the business logic instead of having to manage the low-level memory and hardware as well. C# itself is...
22 Nov 2018 by Afzaal Ahmad Zeeshan
Oh boy, you got polymorphism and type safety all confused up there. What you are expecting to happen is wrong, that is not why a type is inherited. Inheritance works from parent, to child. So a function in parent, is guaranteed—let's ignore the access modifiers in inheritance for a minute—in the...
9 Apr 2020 by Afzaal Ahmad Zeeshan
Quote: reruns itself when 'y' is entered and when 'n' is entered, Sure, for this you make it run again, and again, and again, until the condition (inputing 'n') is met. How do we make a program a group of statements again and again? Use the...
8 May 2020 by Afzaal Ahmad Zeeshan
The remote Desktop is proprietary software by Microsoft, and you would need to rely on what they offer to you if you want to use that software. You can start here; Remote Desktop Protocol - Win32 apps | Microsoft Docs[^] There are some...
30 Dec 2018 by Ahmed Adel
How to create TCP viewer only ms , and make it dll to run with my program to view only TCP ms , thanks a lot What I have tried: i tried to create label to show TCP viewer ms but i can`t create dll to hook on my online game
28 Mar 2017 by ahmed91za
i'm looking for an available guide as PDF specifically targeted at pointers in C++, they are by far the most confusing thing i came across in c++ (along side time and file STL)does anyone know of a comprehensive guide to pointers that could specifically clear it up from begginer point of...
16 Jun 2019 by Ahmed_Khalaf
I use Visual studio 6 to build dll from .rc file using nmake command and it works fine with English, Arabic and French but when trying to generate dll for Russian language it generated with a garbage data not Russian I think this problem is due to vs 6 unicoding and I changed the region(non -...
16 Jun 2019 by Ahmed_Khalaf
I have solved it the bug is that when I'm trying to read string or resource value from dll in gupta(programming language like c++ and c#) it convert the string and read it as garbage data so when reading from dll I convert the string into binary then convert it to string again.
14 Oct 2015 by Ahsan Mughal
Hello. I need to print arabic character using C++, the prob is i dont know how to, please guide me step by step, how i write that program, how to use unicode. Please help me iam beginner.
31 May 2020 by Akinodales
Hi i am a beginner and am a little puzzled on how to make work of the fstream.My assignment says that i need to "use 1 read/write operation".I wanted to know if the information i have obtain throught the user from my code can be saved in a .txt...
1 Mar 2017 by Albert Holguin
It appears that the arguments list is undefined, not sure if this nuance is common to all "embedded" Python versions (i.e. you're calling Python via an API instead of running natively).... but you may be able to get around the issue by setting argv list via the PySys_SetArgv() call:c++ -...
14 Nov 2019 by alex200
I write a programme that removes the odd digits but when I write 1001 it shows "all digits were deleted" how should I change it? What I have tried: #include using namespace std; int main () { long long int n; int digit,o=0,i=1; cin>>n; while( n != 0 ) { ...
29 Oct 2019 by Alexander Lednev
This is a fast binary serializer with compile-time members and version check
11 Dec 2017 by alexandrkuchinsky
Hello! I recently started learning java. Help please with the translation of this code from c ++ to java. It is necessary to write a program that performs an external window clipping. The program should be based on the algorithm of clipping the rectangular Sutherland-Cowan window. I could write...
19 Oct 2022 by Alexandrnn
#include #include int main() { system("dir"); puts((char*)stdin); } #include #include #include int main() { char cmd[10]; strcpy_s(cmd, 10, "dir"); system(cmd); puts((char*)stdin); }
13 Feb 2018 by Allaye
gud day guys, i getting started in c++ and am using linux while writing windows app, but i always get error while compiling codes that includes those windows related headers files like windows.h etc... # include # include #include # include...
9 Apr 2020 by Allen0417
#include using namespace std; template struct tree_node { T key; tree_node* left = nullptr, *right = nullptr; tree_node(T key) { this->key = key; } }; template void insert(tree_node*& my_tree, T...
9 Apr 2020 by Allen0417
It still got same problem after I do tree_node* my_tree = new tree_node(); // syntax may not be correct int key = 65; my_tree = insert(my_tree, 50);
24 Jan 2018 by Altaf Ansari
As you mentioned the languages like c ,c++, java, android, php, javascript, html5 ,python , mysqli Please choose one of them java or php or python.. make yourself expert in any one language and go ahead with that...
12 Nov 2018 by Ameer Salah
I am trying to get map from dll c++ C++ code extern "C" __declspec(dllexport) map createMap(string &fileName) { ifstream infile(fileName); vector bitsLine; bool headerEnded = false; string line; int i = 0; int length = 0; while (getline(infile, line)) { if...
12 Apr 2018 by amirak20
Hi guys, I've been working on a project and I'm having problems with the very beginning of it. I would appreciate any help. So in this task, I should get my input from a file and from what I've learned I can do that using ifstream. I wrote a condition that if the file didn't open send me an...
14 Apr 2018 by amirak20
In my task I should find if there exists numbers between 40-50 in a vector and if it exists what's the index of them. None of the solutions that I've tried works each time I get zero as the value of cnt, I've recently started to work with vectors and I think the issue here is that I'm treating...
6 Mar 2018 by AnanthuAnilkumar
In windows 10 Tab, I have created a sample application contains list control with customized horizontal and vertical scroll bar. While scrolling in vertical scroll bar through touch, sometimes WM_GESTURE message become generated. But in the case of horizontal scrollbar, the issue is not...
17 Feb 2016 by Andreas Gieriet
You have several flaws in your code:You have declared a reference parameter for a fundamental type instead of a value parameter (you do not intend to modify it - so, why a reference parameter?).You pass an rvalue to an lvalue reference (a literal to a reference) - this is not allowed.You...
26 Nov 2017 by Andy Allinger
% is an int operator pow is a double function Convert everything to double and then use fmod instead of %
20 Mar 2020 by Angel Chan
I'm trying to search tutors by overall performance or rating. Which means it will return multiple values. But I only got 1 value. How do I get the code to return multiple tutors instead of only 1, even though their are multiple tutors with the...
19 Jul 2018 by AnnoyingPig
How do I make a user like type in "I'm feeling good" and it reads the "good" part in which the program would respond to "I see, That's great to hear from you" My code is like when i type in "jasdhagood" or anything other than the 'good' itself would respond to blank. sample: User:I'm good...
4 Jan 2018 by AnvilRanger
You can take a look at the Open XML SDK, Welcome to the Open XML SDK 2.5 for Office[^]
27 Aug 2019 by Aravhere
I have MFC application, how can I set clienthostname as [NULL] . I tried below code, now working. I used clienthostname="\0" in my connection string, it does not set value as NULL in database using sybase 16 SP3 driver. However when i use sybase 15.5 driver, it does set value to NULL for...
15 Dec 2015 by Are Riff
I am learning about dynamic memory and have a question.Let say I have this class.class Elf {private: double _health = 0;public: Elf(const double &health){_health = health;}};I can create an Elf object using smart pointer like this.unique_ptr vec1 =...
11 Feb 2016 by Are Riff
How do I pass a reference of a variable into a vector so that everytime I change it's value in the vector, it would reflect back to the original variable.int a = 10;int b = 20;int c = 30;std::vector d {a, b, c};I can already see that I only pass as value to the...
18 Feb 2016 by Are Riff
Why this function fail to compile?It look innocent enough.I use it a lot and works fine, but whenever I try to make a function of it, it fails.#include #include #include using namespace std::literals;void pauseScreen(float &duration) { if ( duration...
19 Feb 2016 by Are Riff
I have a simple question.What container that have this characteristic: - Unique key. - Can be sorted according to the value.I'm trying to implement 'Hall of Fame' section to my project.For each entry it require a string and an integer (name and score).What I have tried:I...
18 Mar 2016 by Are Riff
Hi, I'm new to C++ and this is my second personal mini project. I'm learning about algorithm in TicTacToe.I'm having problem to implement the minimax algorithm into my code here. Anywhere I look, all example have different game implementation from me making it difficult to understand the...
28 Aug 2019 by Aresol1
https://gyazo.com/6bfa7985bdc6...
16 Dec 2017 by Arham Anees
i am using m menu function in c++ console app. it selects on pressing enter key but it i call it back to back then it select first option automatically. how can i clear input buffer so that '\n' is ignored. for example i have 2 menus Create Display Delete Exit
11 May 2020 by aris mihadjami
#include #include #define MAX 6 typedef struct{ int data[MAX]; int head; int tail; } Queue; Queue antrian; void Create(){ antrian.head=antrian.tail=-1; } int IsEmpty(){ if(antrian.tail==-1) return 1; else return 0; } int...
22 Jan 2019 by Arnav Varshney
I wouldn't be posting the entire code here, but I can surely help. This is how I would have had implemented the algorithm. First, take input in a string STR. Then break the string into 3 parts = NO1, NO2, ANS Now check in each string, if it contains the string "machula" Parse the string with...
23 May 2018 by AshishKumar1109
The header file is inherited with other header files as. --------------Header file first--------- #ifndef doing_h #define doing_h class doing{ public: doing(int a){......} fn_doing1(){.........} } #endif --------------Header file second--------- #ifndef something_h #define...
3 Oct 2018 by ashutosh singh
ques. link https://www.codechef.com/LTIME64B/problems/JDELAY[^] #include using namespace std; int main (void){ int t,n,input1,input2,count=0; cin>>t; for(int i=0;i>n; for(int j=0;j>input1; cin>>input2; if((input2-input1)>5)...
6 Mar 2018 by asvyr
So I wanted to make a program that creates x nodes with values 1,2,3..,x and then prints their values, but I can't make it work. Is it even possible? What I have tried: #include class node { public: int val; node * next; }; void NewNode(node *H, int i) //I tried using &H but...
25 Jul 2023 by awesome priyanshu
`\#include \ using namespace std; int main(){ int N; cin \>\> N; int sum = 0; vector\ a(N); int A, B; cin \>\> A \>\> B; for (int i = 0; i \=...
12 Nov 2018 by Aydin Homay
Hi, I think basically what you need to do is to use STL/CLR to map your native c++ container into .Net contains. You can find a good example and useful information at the below link: How to: Convert from a STL/CLR Container to a .NET Collection | Microsoft Docs[^] For your attention: adapter...
13 Apr 2022 by baby monal
In a far away Galaxy of Milky Way, there was a planet Tarth where the sport of Competitive Tiding was very popular. According to legends, there came a new setter who loved maths. Hence, he made TCDSAP (Todechef Certified Data Structure &...
29 Mar 2022 by bartello
How Can I modify template function "sum" to have a compilable code without modifying the main function? I've already tried almost everything. What I have tried: #include #include template...
25 Oct 2014 by Bartlomiej Filipek
A list of my top 5 interesting C++ proposals.for pre-Urbana mailing. Unified Syntax Call, Coroutines, array_view ranges and modules.
29 Feb 2016 by Bartlomiej Filipek
In the article I cover SFINAE, a quite complex paradigm from C++ template programming area. What is this thing? Where can you use it? Let's also look how C++14/17 can help in writing such expressions.
8 May 2020 by Batuhan Sönmez
import timeit try: input = raw_input except NameError: pass try: chr = unichr except NameError: pass p=int(input('Enter prime p: ')) q=int(input('Enter prime q: ')) print("Choosen primes:\np=" + str(p) + ", q=" + str(q) + "\n") n=p*q...
16 Mar 2018 by BerthaDusStuf
I have written this code to test something for some code I am writing and it only works if I use == rather than =: #include using namespace std; int main () { int internal_organ_cream = 5; int liquid_organs = 7; &internal_organ_cream = &liquid_organs; } I tried running it like this...
19 Mar 2018 by BerthaDusStuf
#include #include using namespace std; struct cards { int num; string suit; cards * next_card; }; cards get_card(int num, string suit, cards *previous_card) { cards card; card.num = num; card.suit = suit; card.next_card = previous_card; ...
4 Jul 2018 by BerthaDusStuf
I keep getting the error "multiple definitions of robots::robots()" saying it is first defined on line 8. I cant spot the problem. Can someone see what is wrong? Here is the main.cpp file: #include #include "enemy_definitions.h" using namespace std; int main() { robots Bertha;...
23 Jul 2018 by BerthaDusStuf
I am trying to set up OpenGL for my codeblocks but I keep getting an error. Here is what I have done so far: I downloaded the 32 bit binaries for GLFW from this website: GLFW - Download[^] I also downloaded GLAD from this website: http://glad.dav1d.de/ I then added all the files from these...
2 Sep 2021 by Big Spudnuts
I am creating a very basic library system. I have a set called books and one called author. They are both filled with user input, I have no problem with that. The user will select an option to retrieve all book names from a menu option. This...
12 Jun 2019 by BillWoodruff
Is it possible you are looking for an iterative solution ? I suggest you start by understanding DP is recursion, but, bottom-up, not top-down. Your data/problem may not be suitable for a DP solution. Good discussions to get an over-view: [^], and [^] And, this MIT video a good resource: [^]
22 Apr 2018 by Binwaxme
how to solve the traveling sales man problem using minimum spaning tree using C++ or java programmng What I have tried: traveling sales man problem using minimum spaning tree using C++ or java programmng
4 Nov 2019 by BlackMATov
One of the currying options and partial application of the functions in C++ which is my personal favourite
31 May 2017 by brokkster
I am building a custom data structure that is a binary tree of objects and binary trees. ie: each node in the top level tree could be an "object" or an "objectContainer" (which in turn could have "object"s or "objectContainer"s for nodes). I have a message pump in my main thread, through this...
2 Feb 2023 by Bruno van Dooren
Ways to enforce an interface contract on static methods, similar to what you would expect from static virtual methods if they'd exist in C++
17 Jan 2024 by Bruno van Dooren
I wrote an article about that. Check it out. Using C++ Move Semantics to Manage Pointers to Externally Allocated Memory[^]
8 Mar 2017 by Bryian Tan
CMFCColorDialog? I found several examples on GoogleColor Picker Combo Box[^]visual c++ - How to add color picker in mfc? - Stack Overflow[^]The Ultimate Toolbox Home Page[^]
13 Oct 2015 by Bsm Pro
i'm doing a schedule generator for my university using a genetic algorithm and i made a chromosome that represent the problem ,i want to know how to fill the chromosome in a random way respecting the hard constraint like: (two lecteur can't be in the same room at the same time ....) using a...
26 Oct 2018 by cassanelligiovanni
Hi, I'm a programming student and in these last years I touched various programming languages : C++, Java, Javascript, Python. For my third year project I was planning to develop a Music Loop Software that acquire up to 8 inputs from an external audio interface and loop them in different...
9 Apr 2017 by Cat Rabbit
The file ITEMTYPE.H is here. // The following declarations and definitions go into file // ItemType.h. #include const int MAX_ITEMS = 5; enum RelationType {LESS, GREATER, EQUAL}; class ItemType { public: ItemType(); RelationType ComparedTo(ItemType) const; void...
22 Feb 2022 by CDotpp
I'am developing a Book Management System. My Code Writing datas to a txt file. Datas Holding Like; Book ID Book Name Author Name Page Count-> 213154 Harry Potter and the Philospher's Stone J. K. Rowling 224 I write an update fucntion for when...
7 Nov 2018 by CesatAGS
Hi, guys, i have this structs in c++ and i wnat to convert this to c#, how i can code more close in c#? template struct pares { DWORD64 first; T* second; }; template struct hash_node { pares mValue; hash_node* mpNext; }; template...
10 Nov 2018 by CesatAGS
Hi, i write a dll that is injected on game and return my localplayer and listArrayplayer on server. Ok work fine code dll project: __int64 RerturnLocalPlayer() { __int64 player = GetLocalPlayer_EX();// __Int64 GetLocalPlayer_EX is function that return my player return player; } in my...
13 Nov 2018 by CesatAGS
i have this code PIPE Server C++ #include #include #include #include // see https://msdn.microsoft.com/en-us/library/bb546085(v=vs.110).aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1 // for information on creating pipe clients and servers in c++...
9 Mar 2017 by CHill60
We don't do your homework for you. You will not gain any benefit from just copying someone else's solution.Refer to your course notes, or ask your teacher for help.Give it a go, it's not as hard as you think. Once you have written some code, if you are still getting problems then come...
20 Mar 2017 by CHill60
In C++ you should be usingusing namespace System::Threading;See the documentation - Thread Class (System.Threading)[^]
9 Aug 2018 by CHill60
Google is your friend... Integer (computer science) - Wikipedia[^]
9 May 2018 by Chris Losinger
if you can't change then class, then no, you can't call a member function without instantiating an object (aka calling the constructor).
19 Jul 2017 by chunky77
Given an array of size n and multiple values around which we need to left rotate the array. Input: First line consists of T test case. First line of every test case consists of N and K, N denoting number of elements of array and K denoting the number of places to shift. Second line of every...
2 Mar 2020 by CJGlandor
I do not have anymore questions at this time. Thank you. Bye. What I have tried: THis needs to be in C++. I truly have no clue where to start on this.
6 Nov 2019 by cjoshit
I have application called as Agent which have 2 projects : 1. C# project 2. C/C++ DLL Whole application was running fine with .NET 3.5 which we use to build with vs2008. Due to some requirement we upgraded the .Net Framework to 4.6 and vs 2019 to build this up. Now my application service...
29 Jul 2021 by Code Fan
They are streams, so you want to pass them by reference & not by value. Otherwise, you make their shallow copies that don't update their original internal pointers anymore.
26 Jun 2017 by code_enthusiast
Is it possible to develop Bluetooth low energy applications in C++ using Bluetooth low energy functions which should work on both windows 8.1 and windows 10 ?? What I have tried: If it is possible, Is there any code sample that i can use?
28 Jun 2017 by Coder969
We are migrating our projects from vs2005 to VS2015 .In one of the project we are using below template declaration template In 2005,it is building successfully but in vs2015 getting below error. 'WindowClass': illegal type for non-type template...
5 Oct 2018 by codingBlonde
int * p = NULL; // the size of p is:________. // the value of p is:___ ____ double * q=NULL; // the size of q is:__________ // the value of q is:________ char * t=NULL; // the size of t is:________, // the value of t...
5 Oct 2018 by codingBlonde
/* A function that reads a sequence of integers from input (with the length of sequence, followed b For example, if the length is 3, and the numbers are 123 345 99 then the array returned will be of size 3, and stores values 123, 345, and 99 @param length: upon return, stores the length/size of...
4 Nov 2019 by CodingUniversity
Hey, My program is download image file and changing the desktop wallpaper, My problem is that i don't know how can i use the "savepath" variable inside a unsigned char without getting any errors. Can you help me ? string dwnld_URL =...