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...
[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...
[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...
[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...
[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...
[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...
[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...
[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. ...
[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" << ...
[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...
[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==...
[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...
[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
[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...
[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...
[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...
[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 ...
[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:...
[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...
[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...
[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.