General C++ Programming - February 2016 (Page 16)

by josex
subroutine & pointers help!
I created a program based on the instruction below, but do not know about this pointer, subroutine and Void issue. Can someone fix my C++ base on the below ins...
Feb 9, 2016 at 12:21am
[3 replies] Last: Thank you so much. I will look at this and learn it. My coding did e... (by josex)
type error in struct?
Below I am getting the compiler error: src\main.cpp:7:2: error: 'Card_Ranks' does not name a type Card_Ranks rank; ^ ..\src\main.cpp:8:2: error: 'Card_Sui...
Feb 8, 2016 at 11:19pm
[4 replies] Last: Forward Declarations (by RUNNER PRO AGARIO)
Application crashes in Debug mode, but doesn't in Release mode
Hi. As a test, I'm using this code #include <iostream> #include <conio.h> #include <string> using namespace std; string* foo() { string ref = "hehhjhjh...
Feb 8, 2016 at 10:41pm
[2 replies] Last: I'm using VC++ compiler, not GCC. And yes, it warns me but in Debug m... (by gedamial)
std::array out of range error in simplified Blackjack game code
On LearnCPP, there's an exercise asking to play a simplified version of Blackjack. I was having trouble, so I looked at the Solutions while doing it. But when...
Feb 8, 2016 at 10:28pm
[18 replies] Last: I'll try calling the printCard() and printDeck() functions in main(). ... (by DragonOsman)
Vector is loading values (int) that it should not
I have written a program that asks the user to input integers 10-100, inclusive, and load them into a vector. It should validate the number, check for duplicate...
Feb 8, 2016 at 8:56pm
[1 reply] : validateValues does more than just validate a value (why is it plura... (by cire)
I need to make this program shorter
I have this program #include <iostream> // cin, cout #include <string> // strings #include <Windows.h> // Sleep() #include <conio.h> // getch() #inclu...
Feb 8, 2016 at 8:53pm
[1 reply] : I suggest some functions. Try to reduce the code duplication. Also I... (by jlb)
What do you think of my SDL2 program so far?
Hi everyone, I started learning C++ last month. I've learned enough basics to begin working with the SDL2 library. I'm starting to make a game. My code b...
Feb 8, 2016 at 7:46pm
[3 replies] Last: Why make the SDL_Event object a a local variable in game loop instead... (by Peter87)
Please Help !
The C++ syntax has real molested me. I am completely stuck. For those who has assisted me before and the other programmers in the forum, i have this problem. ...
Feb 8, 2016 at 7:14pm
[9 replies] Last: One of the goals of a database is to not read all the records into m... (by dhayden)
Copy constructor gets called instead of inizialier_list<> constructor
Hello. struct Foo { Foo() { cout << "default ctor" << endl; } Foo(std::initializer_list<Foo> ilist) { cout << "initializer list" << ...
Feb 8, 2016 at 3:53pm
[5 replies] Last: because i'm explicitly converting the floating-point number no, it c... (by Cubbi)
My static library project is somehow related with my 'test' project
Hello. I've made my own Static Library project on Visual Studio. The problem is this: unless I personally test the code in another separately created proj...
Feb 8, 2016 at 12:42pm
[10 replies] Last: Thanks to everyone ;) (by gedamial)
problem in POPPING ARRAY QUEUE
#include<iostream> #include<stdlib.h> #include<conio.h> using namespace std; const int s=50; int f=-1, r=-1, q ; int insertAQ(int q , int ele) { if(r==...
Feb 8, 2016 at 11:13am
[2 replies] Last: Yes you are right. Thanks. (by gaurav97)
bubble sort error
#include<iostream> using namespace std; void swap(int&a,int&b) { int temp=a; a=b; b=a; } void BubbleSort(int a ,int size) { bool not...
Feb 8, 2016 at 10:16am
[5 replies] Last: THIS IS A SIMPLE VERSION OF YOURS. HOPE IT HELPS... #include<iostream... (by Kinyo356)
by kalki
Finding out no of 1's in a given no ??
How to find number of bit set in any given number ? Say int x=7; Number of 1's set in x are 3
Feb 8, 2016 at 9:12am
[1 reply] : In three steps: 1. Your number mod 2 to get the final bit's value. 2. ... (by TwilightSpectre)
Unresolved issue
I get the error 1>Rpn.obj : error LNK2019: unresolved external symbol "public: void __thiscall Queue::add(float)" (?add@Queue@@QAEXM@Z) referenced in functio...
Feb 8, 2016 at 5:46am
[9 replies] Last: Ok. make elements of type float then :+) And make Queue::add ac... (by TheIdeasMan)
Error Vectors out of range
The error says Error: Vector subscript out of range i have 3 chosen for k, i do not see how it is out of range #include<iostream> #include<vector> #inclu...
Feb 8, 2016 at 4:21am
[1 reply] : Hi, You are using n (= 10) in the for loop, but numbers only has ... (by TheIdeasMan)
Double Digit sort issues
In the code below I have created a simple bubble sort algorithm. It works for the most part but for some reason it can not properly handle single digits that a...
Feb 7, 2016 at 8:41pm
[2 replies] Last: Right, that makes sense, thanks (by AgentNoise)
Vector Inventory problem fixed
This is my implementation of a vector based inventory system. I had a lot of help from AbstractAnon,jlb, && cire. If anyone has any recommendation or any fixes ...
Feb 7, 2016 at 8:13pm
[12 replies] Last: So after some tinkering i have found that it is better to use pointers... (by NoviceNate333)
Access violation exception thrown - please help
When trying to fill an array of structs, I got the following exception thrown: Unhandled exception at 0x00007FF61B187C6E in learncpp_chapter6_comp_quiz2.exe:...
Feb 7, 2016 at 7:59pm
[5 replies] Last: Look at your sort function: void selectionSortNames(Student students ... (by jlb)
c++ and joystick
Hello everyone. I want to know if there is a way to manipulate joystick with c++ without using any library, I mean can I write my own library ? Thanks a l...
Feb 7, 2016 at 6:03pm
[3 replies] Last: @Thomas1965, thanks for the reply. I know a few libraries does the sa... (by closed account 28poGNh0)
memory leak in code snippet?
Is there a memory leak in this code snippet with ptr being reassigned to another address &x to &y? int main() { int x = 5; int y = 7; i...
Feb 7, 2016 at 5:40pm
[4 replies] Last: Thx for clarifying. (by technologist)
February 2016 Pages: 1... 1415161718... 21
  Archived months: [jan2016] [mar2016]

This is an archived page. To post a new message, go to the current page.
Registered users can post in this forum.