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

c++ program
 
hello everyone I am trying to make a program which identify the format and only take the specific data for example if user enter the format such reg:12345 dat...
[6 replies] Last: you want to read the substrings only if the regex_match returns true (by gunnerfunner)
Convert String to Integer With Error-Checking
 
I want to convert a string to an integer and validate that it is an actual integer. The following is what I have. An extra pair of eyes can help me locate a pos...
[4 replies] Last: Thank you. You've made me rethink some of my logic and clean up my cod... (by TheNoviceDev)
Why does std::cout.flush doesn't flush at the end of a loop ?
 
Hi everyone, here's the piece of my code relevant for this question: int speed = 5*n/100; for(int j=0; j < 3; ++j) { for(int i = 0; i < n; ++i) ...
[6 replies] Last: By the way, in my .bash_aliases I have set: alias g+='g++ -Wall -Wex... (by TheIdeasMan)
Need Help With This :(
 
Iv'e been trying to solve this for a couple of days now and i cant seem tosolve it. Joe’s Pizza Palace needs a program to calculate the number of s...
[5 replies] Last: Change PIrr to PI * r * r Multiplication is not implicit; in orde... (by mbozzi)
Just getting started
 
I am getting started in C++ programming and going through some tutorials. I am trying to brush up on programming and I do not have any experience per say. Sin...
[1 reply] : Essentially it's telling you to create a function that takes 3 paramet... (by Hengry)
plz double check - is this correct way
 
Unintended consequences for this setup or am farming the function out correctly? fx.h * * Created on: Jan 29, 2017 * #ifndef FX_H_ #define FX_H_ ...
[5 replies] Last: It seems you dont have to include .cpp files though? Right. If you'r... (by cire)
Help removing one line of code from output!
 
Hello I am trying to have my output not write the first line of code, it's the reason my project keeps failing. I was thinking about a if statement? http://i...
[no replies]
Function to find largest number out of a group
 
So, i put together a quick code, and i need to be able to find the highest value out of a bunch of int variables (va, vb, vc...) and i chose to use an array. I...
[6 replies] Last: Okay, that sounds good, thanks. I'm looking at sorted maps right now ... (by rfitz123)
by King39
File Encryption Bug
 
Decrypted file has the same message as the original except it adds a few letters (usually 2). For example "abc123" = "abc12343". So far I couldn't find any rea...
[4 replies] Last: ty (by King39)
How should I search this?
 
I am trying to find forms using C++ and OpenGL to make a checkerboard and have users click within a box and have a circle fill in the box. I've tried searchi...
[2 replies] Last: I see makes sense. I know also using an array in my case helps. I am j... (by raboki898)
Seg Fault and not sure why?
 
#include <iostream> #include<fstream> #include <ctime> #include <string> #include <unistd.h> using namespace std; string readandtype(string fn){ ifstream ...
[2 replies] Last: Ah so not returning a string cause the seg fault? Thanks for the help ... (by ryanismyname)
problem 78 project euler
 
Coin partitions Problem 78 Let p(n) represent the number of different ways in which n coins can be separated into piles. For example, five coins can be separate...
[2 replies] Last: Don't know if this is the fastest way; one approach is to generate par... (by JLBorges)
the same meaning?
 
I am reading materials about cpp memory model. The two snippet codes have the same meaning? struct { char a; int b : 5; int c : 11; int : 0; in...
[4 replies] Last: Thanks (by gunnerfunner)
How to rewrite following C++ code into C code?
 
How to do this in C? Please write entire code, because general hints don't help me. #include <iostream> using namespace std; int main(){ double**ptr=...
[1 reply] : Duplicate request... http://www.cplusplus.com/forum/beginner/207217/ ... (by whitenite1)
Method 'setprecision()' does not work!
 
In following code setprecision(11) does not work at all, it prints 41.3328 - not 11 digits !What is going on? #include <iostream> #include <cmath> #include <io...
[1 reply] : In following code setprecision(11) does not work at all, it prints 41... (by Mantorr22)
by rizan
help me fix the following code pls
 
please help me fix this code, //Hospital doctor information system #include <iostream> #include <string> using namespace std; int main () { string we...
[11 replies] Last: this still appears to have errors pls fix thank u OK rizan, I think ... (by closed account 48T7M4Gy)
by c320
What does this mean *((int*)(&val) +1)
 
Hello, I'm trying to understand this line of code. Can someone help me? Is it saving the result in the variable val or in the address of the variable val? ...
[2 replies] Last: You did not show the type of val. It does not affect the explanation,... (by keskiverto)
Youngest C++ Programmer you've talked to
 
Currently i'm 12 and I know a lot of C++, but this made me wonder, who's the youngest C++ programmer you have talked to/heard of?
[2 replies] Last: Not sure if he used C++, but that's the youngest I have heard of. htt... (by Golden Lizard)
How to use a makefile
 
I've written a makefile and saved it under the name "MakeFile" (provided below) for my program. It's in the same folder as my programs. I'm using a Macbook pro ...
[1 reply] : If you want to specify which makefile to use you can do so using the ... (by Peter87)
Program help!
 
Hello, How do I make a program does this: dividing 115/45 and it only prints the whole integer which is 2 and takes the remaining 25 and put it in a cout sta...
[2 replies] Last: Super simple version of this: int main() { // assigning a de... (by TheNoviceDev)
January 2017 Pages: 1234... 13
  Archived months: [dec2016] [feb2017]

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