General C++ Programming - February 2017

Trouble Bubble Sort of book titles
 
I need to make s c++ code of sorting of book titles. 1. display the Inputted book titles. 2. display the book title in Alphabetical order. i was able to do the ...
[9 replies] Last: @FurryGuy (1237) is it possible to put 2 While here because i need t... (by spike32)
by mjoy
Did I do the code correctly for my C++ homework for generating floating point random variables?
 
Generate 2,000,000 normally distributed random numbers using the Box-Muller's method. I'm pretty new to coding and worked through this with a friend but I'm no...
[2 replies] Last: Supposedly c++11 uses the box-muller. The internet said so, so it mus... (by jonnin)
Problems iterating through a map
 
I snipped the offending code out of the project here: string key, value, buffer; map<string, string> configMap; while (getline(configFile, buffer)) { if (!b...
[3 replies] Last: Line 5 should be if (buffer.find('=') == string::npos) { (by dhayden)
by mal24
Object Array
 
I have an object array with 4 objects. Each of these objects is assigned x and y coordinates. When the user inputs their own coordinates the program finds the...
[4 replies] Last: closest = -1; //-1 is an invalid distance int dx = -1; //invalid arr... (by jonnin)
C++ - low level access to HDD/USB stick.
 
Hello, Windows 7 & 10. Compiler - gcc version 5.3.0 (i686-posix-dwarf-rev0, Built by MinGW-W64 project), Windows Defender and my anti-virus turned off. ...
[9 replies] Last: Hello, dhayden Thanks, I did. Regards (by alonso12)
GPA program
 
Write a program in which you will ask the user to enter his/her GPA and print the grade according to following table. Note: The type of variable used for GP...
[4 replies] Last: Using the comparison operator== or operator1!- to compare floating poi... (by jlb)
by AceK
Is there an HTML parser library for C++?
 
Hi there guys, I am creating this web crawler using C++ and the Qt library. Everything is working fine so far however I have difficulty extracting the data I am...
[4 replies] Last: Google/Gumbo: C99, but the claims are impressive: 'Passes all html5li... (by JLBorges)
by vgdd
What is wrong with this code
 
vector<int>::iterator iter; // increment each score for (iter = scores.begin(); iter != scores.end(); ++iter) { iter++; }
[5 replies] Last: let assume score.size() == 1 ++iter and iter++; will be executed and y... (by alexanderSS)
Need some help with this class, please someone help me
 
Objective: To design and develop a class in the C++ programming language. Assignment: Define a class in C++ whose purpose it is to represent a student of ...
[4 replies] Last: ive done it (by fdejesus4)
by MojoJo
My function returns an address instead of an integer
 
Can somebody tell me why I keep getting an address when I run the length function? I don't have any of the other functions or even the list implemented but I th...
[2 replies] Last: Ah okay thank you so much! (by MojoJo)
Complex Number Calculator
 
The code below should follow the inputs entered by the user, however when I "*" I get a different value for the Current Value is. I think this is because of the...
[2 replies] Last: In your multiply you are using the new value of a to compute b . Yo... (by lastchance)
What is the precise data type of any array of 20 vectors of strings?
 
What is the precise data type of any array of 20 vectors of strings? Is this correct? anyArray<std::vector<string>, 20>;
[2 replies] Last: Thanks! (by dtfskull)
HELP reading txt file
 
Below is a snippet of my code: int counter = 0; in.ignore(1000,':'); in >> dataFile; cout << dataFile; ifstream dataFile; readData( in, ISO, ISO3...
[1 reply] : ifstream is a type, so you need to create a variable of that type and ... (by edge6768)
How to update current iterator while iterating
 
So in this code: std::map<std::string, int> map; map["a"] = 1; int times = 0; for (auto i = map.begin(), e = map.end(); i != e;) { auto cur...
[7 replies] Last: One thing that you need to be very very clear on: it's often invalid t... (by dhayden)
by deady
Merge and Sort Two Files Into Another File
 
Kind of in a pickle here. I have to write a program in which I have two files that have numbers in them (already sorted in ascending order). Then, as the title ...
[4 replies] Last: Gotcha, thanks! (by deady)
What naming convention to follow for constructor parameters with same name as class member variables.
 
Hi people :), I was just looking if there is any convention for naming the class constructor parameters if they are similar to member variables (may be with ...
[5 replies] Last: Thanks @Cubbi for the well formed response :) (by kapil2905)
by Echo89
My Cout repets itself twice, how do i stop it?
 
Below is the code for my electricity bill calculator. and once i enter the values it prints "your electricity bill is " twice. how do i stop it? #include <i...
[4 replies] Last: You need to understand the difference between if/else and while loop. ... (by arbwok)
TCP Server w/o listening/accept???
 
I havew a need to grant a TCP socket connection from a remote process. But I only want to allow one connection, and I don't want to have to use the accept funct...
[2 replies] Last: JL Borges... What a sweet and elegant solution!!!! All of these years ... (by Non Sequitur)
Troubles with binary
 
To Chervil. Errors between lines 6 and 24. I suppose you will correct them easily. Thank you very much. /*artillery.cpp*/ #include <fstream> #include <strin...
[2 replies] Last: To Chervil. How fast you are ! Maybe you are stronger than Alex Allen.... (by sylvain)
For some reason the variable "percent" is returning 0 when divided by mArea
 
#include <iostream> #include <string> #include <cmath> #include <iomanip> using namespace std; int main() { int sum, nShapes, mLength, mWidth, mArea, percent...
[3 replies] Last: Oh, i completely blanked on that. Thank you. (by amajmundar1)
February 2017 Pages: 123... 16
  Archived months: [jan2017] [mar2017]

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