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

HOW TO READ AND DISPLAY A SPECIFIC STRING FROM TEXT FILE AND DISPLAY TO SCREEN.
i would like this code to search through the textfile for data a user will specify at runtime. Then display to screen whether the string was found from the text...
Jan 30, 2016 at 1:35pm
[1 reply] : Hi, Please use code tags: http://www.cplusplus.com/articles/z13hAqk... (by TheIdeasMan)
string problem
#include<iostream> #include<string> using namespace std; int main() { string s; cin>>s; int l=s.length(); int count=0; for(int i=0;i<l;i+3) ...
Jan 30, 2016 at 9:30am
[2 replies] Last: Your for loop is wrong. for(int i=0;i<l;i+3) I guess you want to in... (by Thomas1965)
Is there significantly more overhead repeatedly launching a thread than just having one running constantly?
I'm not looking for high performance as I am managing lots of TCP socket connections and not a UDP thing, however I don't want to make any clearly bad practice ...
Jan 29, 2016 at 11:19pm
[9 replies] Last: I forgot just how fun you guys were. (by devonrevenge)
Matrix generator for a specific determinant
I tried to generate a matrix with the code below. It works, but it has some isues. One of them is that for a matrix NxN, the code generates random elements, but...
Jan 29, 2016 at 10:13pm
[10 replies] Last: Yeah, not a good idea... I really need det(M)=1 or -1. If you still w... (by closed account zv05oG1T)
Getline function error
Maybe it's just me but for some reason when input the size of the string array I can really only input the size I inputted - 1. For instance, If i make my strin...
Jan 29, 2016 at 10:05pm
[2 replies] Last: Holy crap I never even knew that. Dang you got some good knowledge and... (by rabster)
Char to int (MinGW)
I don't know if it matters but I'm using MinGW compiler. I have created a GUI program using Win32 API and have come very far. What I just need to know to be abl...
Jan 29, 2016 at 7:44pm
[18 replies] Last: Solved! Guys the problem was sooooooooo simple and I wasted hours. The... (by TheSocket)
How to do this?
I have to solve the following problem in C++ and I have no idea how to do this... "A parent process sends an array of numbers to another process (son). The s...
Jan 29, 2016 at 7:32pm
[1 reply] : What are you having a problem with, the GUI or the prime numbers? For ... (by pnoid)
Divide operand
To anyone who may know how to help; I have a line of c++ code that was giving me a wrong answer when it ran, it gave an answer of 0. The code as written was...
Jan 29, 2016 at 6:19pm
[2 replies] Last: I think I understand now and where else I may have issues... thanks (by benkitt)
Images in graphics.h
I am trying to display an image and it seems that readimagefile doesn't work... I am not sure why. Could you give an example of a c++ code example in which read...
Jan 29, 2016 at 6:00pm
[5 replies] Last: What IDE and compiler are you using OP? (by Computergeek01)
so, is there an easier way to create maps for say, a pac-man clone than hard coding rectangles?
Im not even asking for pseudo code or anything, just a concept. I thought pac man would be a good project because it is simple (even the AI i have an idea for, ...
Jan 29, 2016 at 5:40pm
[3 replies] Last: there are other objects, such as the dots and the sprites themselves.... (by helios)
Movement of Knight in Chess!
Hi everyone, So in chess, the knight moves in a very special way: either: two squares forward and one to the side or : one square forward and two to the side...
Jan 29, 2016 at 4:22pm
[11 replies] Last: Yes, apologies, I studied English long time ago in the US.... ☺ I di... (by AmmmG 01)
Writing object into binary file
I have an object declared as such: #include <iostream> #include <fstream> #include <string> using namespace std; class NodeType { private: int v...
Jan 29, 2016 at 4:09pm
[10 replies] Last: Either approach could be made to work but writing only the attributes ... (by Computergeek01)
Possible movement of Knight in Chess.
I have to do a program where the user is asked to enter the 2D position of the Knight on the Chess board and then the program is asked to show all the possible...
Jan 29, 2016 at 1:31pm
[1 reply] : #include <iostream> constexpr int N = 8 ; // board size using board_... (by JLBorges)
Opinions on coding of Parallelism in C++
Hey All I'm working on some exciting new Parallelism tooling for C++ with the University of St Andrews in Scotland. We gave a presentation on this at the Edin...
Jan 29, 2016 at 11:24am
[2 replies] Last: In the tool we're creating we are building upon and extending these me... (by craigmanson)
by lilaii
Shared memory with services
Hi, I have two applications, one 32 bits and one 64 bits talking through a dll which I made in 32 and 64 bits and use shared memory. It communicates perfectly...
Jan 29, 2016 at 10:33am
[no replies]
Quick Dirty Command Line Parser Isn't working
Hi, I made a quick command line but not sure why it's not working? It seems the for loop is wrong. The code results in this. $ ./AlphaToolbox --makegame...
Jan 29, 2016 at 9:10am
[1 reply] : The first argument (0) is always the executable (and path). So start t... (by coder777)
! File handling in C++ !
Please tell me what this line do-> while (f1.read((char*) this ,sizeof(park))); Please tell what's the use of WHILE and THIS in this statement....
Jan 29, 2016 at 8:54am
[1 reply] : this : http://www.learncpp.com/cpp-tutorial/8-8-the-hidden-this-poin... (by coder777)
Why to write int(in_time.ti_hour) ?
cout<<"Park-in time: "<<int(in_time.ti_hour)<<":"<<int(in_time.ti_min)<<":"<<int(in_time.ti_sec); Why I have to write int(in_tie.ti_hour) can't I just wr...
Jan 29, 2016 at 8:54am
[2 replies] Last: Is ti_hour a char type ( char , unsigned char or signed char )? The... (by Peter87)
Pointer can become array ?
Example if i write int* a; a =5;can ?
Jan 29, 2016 at 8:34am
[2 replies] Last: You can use array syntax with pointers. a is the same as *(a + 1... (by Peter87)
Help!! Debugging issue
Can I get a set of fresh eye on this bit of code... the getline function is not letting me do the user input for the search. do I have it set up wrong? Pleas...
Jan 29, 2016 at 6:58am
[2 replies] Last: You just need to include a line before the getline function is called ... (by Stalker)
January 2016 Pages: 1234... 18
  Archived months: [dec2015] [feb2016]

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