General C++ Programming - November 2016

Problem with writing into file (fstream)
 
Hi! I have a FOR LOOP for writing an index file. My index file depend the word that i receive in parameters and I make calculations to place my word in the i...
[no replies]
helpp ASAP function and array
 
i need to write a function that uses a file to fill up an 2 arrays string and double that is in main. im lost help please thanks
[2 replies] Last: i do kinda know how to use arrays, im looking at tutorial right now. ... (by waqarmalek)
Error allocating memory
 
Hey, first of all, i am writing my Code in C not, C++. I hope you could help me though. As the title says i've got an Problem after allocating memory for an ar...
[3 replies] Last: Do you call it before trying to access pressureentries? (by Peter87)
Please Help!! Arrays
 
Can anyone explain how to write this program? A group of 50 people have gone apple picking at Shayde Brook Farms in Pennsylvania. Each person has collect...
[1 reply] : help with what ? (by SamuelAdams)
by ddz
Problem with "if" in the code
 
Hello Guys, I am new to programming so I don't know what is wrong in if / else if statements. No matter what it displays else statement. Help will be app...
[3 replies] Last: Thanks @Chervil. I am new so I didn't knew about that. Now I figured I... (by ddz)
My code for line[34] how to make it grab the data
 
I'm grabbing data from an html file and I need only the 34th character or above to 4 spaces only on certain lines that have the html that have *racelinesb" but ...
[1 reply] : How to use code tags http://www.cplusplus.com/articles/jEywvCM9/ (by SamuelAdams)
Friend and const doubts
 
#include <iostream> using namespace std; class Comp{ private: float r, i; public: Comp(): r(0),i(0){} Comp(float tempReal, float tempImg): r(tem...
[3 replies] Last: Thank you both, gunnerfunner und cire. I manage to make it the way i w... (by drporto)
by domcho
Problem with istream_iterator
 
I am trying to read an object from a file. It's a student who has a name, number of grades and grades. The problem is when I use istream_iterator method my func...
[2 replies] Last: Works perfectly! Thank you very much! (by domcho)
Standard input/output help C language
 
Assume that word is an array of chars containing a string . Write a statement to display the message "Today's Word-Of-The-Day is: " followed by the value ...
[1 reply] : Try this: printf("Today's Word-Of-The-Day is: %s" , word); ... (by Thomas1965)
my poor lottery checker program
 
#include<iostream> #include<string> #include<cstdlib> #include<time.h> using namespace std; //function prototypes void genwinNumbers(int ); void displayNumbe...
[1 reply] : This is only a warning and isn't a problem. You have a problem with ... (by coder777)
My menu isn't very intuitive.
 
My menu isnt very intuitive. How can I make it a case-switch menu instead? Also, I would like for the program to eventually display results when the user choose...
[1 reply] : Please, use code tags for readability. [ . code . ] Code here... [ ... (by boost lexical cast)
Solved it, got the data i needed for line[34].simple code
 
using namespace std; int main () { ifstream infile; infile.open("page.out"); string line; string sub; string sub2; string number; int cou...
[no replies]
Help trying to get Player to interact with Monster
 
Hey everyone, I've been trying to create my roguelike type of game for C++ using the ncurses library. After following many different tutorials, I have ended mys...
[no replies]
Why wont a substring method work in a while loop
 
I was using getline(infile,line) for an out file that I had, and I tried to use line.substr(5,5); all of this was in a while loop. And the substring method thro...
[2 replies] Last: Good ideal, maybe some of the lines only had a few characters but some... (by Jonjonscove)
Why does the get line method take more than one line sometimes
 
I'm using the get line method for an infile file. Getmethod(infile,line). When I print the results of the line in a while loop. Some lines only have a couple o...
[no replies]
input Max and Min in array
 
I can't seem to figure out a way to implement a max and minimum to an array. where it will only output numbers between the max and min. any help will be highly ...
[7 replies] Last: // Project8.cpp : Defines the entry point for the console application.... (by Kevin10official)
by J4999
Counting occurences of value in an array, and duplicates
 
Hello. I have to find the occurences of every element in an array, but I don't know how to get rid of duplicates. Example: #include "stdafx.h" #includ...
[2 replies] Last: a dynamic two-column table ...better known as "map"? std::map<int, ... (by Cubbi)
Reading in a binary relation
 
I'm trying to read in a binary relation from a user that comes in the format of {(1,2),(1,4),(2,3),(2,5)} I can't figure out how to only grab the integer value...
[no replies]
Passing function as argument to an other function
 
What is the right and most up-to-date way of passing a class member function to an other function as an argument? Suppose, I have a function with this signature...
[3 replies] Last: Sure... bind() itself provides partial application. Without gettin... (by mbozzi)
Card game
 
Hello, I need some assistance with my program. I have not started it. I am a little confuse Input: there will be 5 lines of input. Each line will contain the...
[1 reply] : Hello, I'm sorry if I'm wrong of your intentions, but may I remind you... (by pigeonfizz)
November 2016 Pages: 123... 23
  Archived months: [oct2016] [dec2016]

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