General C++ Programming - February 2015 (Page 6)

Syntax Error?
 
#include <iostream> #include <math.h> using namespace std; int main() { char a, s, m, d; //variables for add, subtract, multipl...
[2 replies] Last: Thanks, can't believe I didn't realize that. Works fine now and I edit... (by Rodr1697)
by Kevint
Switch/case need help
 
So we have a weekend assignment that is "Write a c++ program that will allow a user to input their first name into a string, and use the switch/case statement t...
[7 replies] Last: Never mind i FINALLY got it. thank you so much for your help (: (by Kevint)
C string program
 
Can someone please show me how to do this? replaceSubstring Function Write a function named replaceSubstring. The function should accept three C-string or str...
[1 reply] : What have you written so far? What specifically is confusing you?... (by LB)
Quick look at "Accepts a pointer to a C-String" What does this mean???
 
I have made this program run, however in the book it says my functions should "accept a pointer to a c-string as its argument." Please help me if you can. ...
[6 replies] Last: Thank you, I thought I had that, guess I overlooked it lol (by TheDMinor)
c++ converting pseudo code for runtime
 
I am given the following information, i am trying to convert this in a function. c ← 0 for i ← 0 to n - 1 do s ← 0 for j ← 0 to i do s ← s + A for k...
[4 replies] Last: Ah, thank you i cant believe i didn't notice that. haha Thanks (by hoofhamples)
I/O problems including a map container
 
Hello, I am having a hard time understanding what the problem with my code is. The problem that occurs is coming from the I/O I believe. I am creating a bank...
[9 replies] Last: if im understanding correctly of the reporducable code this should be... (by MiiNiPaa)
by rich1
Column sums
 
Hello world imagine you are given a matrix of positive integer numbers (maximum 25*15, value of number does not exceed 3000000). When you do column sums and pi...
[2 replies] Last: Your solution was the first that sprung to my mind and yes - it's not ... (by rich1)
problems with for command
 
Hello, this is my assignment: Write a program that will predict the size of a population of organisms. The program should ask the user for the starting numb...
[1 reply] : Please put your code in code tags: [co de]Put your code between thes... (by Disch)
by srowe
Formatting iostream for readable hex.
 
My problem is that the setfill('0') doesn't affect the output; I want four columns of 64bit numbers in hex which I read in binary mode from a file. Any help wo...
[6 replies] Last: Right again. Boy I am rusty. lol Thanks. And yes the class library i... (by srowe)
Finding a char array in a large file
 
I have a specific byte (that is unsigned char) array, that I need to find in a very big file (2GB or so), currently I'm using: size_t fsFind(FILE* device, byt...
[6 replies] Last: Use a string search algorithm (instead of a pattern-matching algorithm... (by JLBorges)
Search a dynamic array for a string, and return the indices
 
Hello. I am looking for help with my program. I need it to search a dynamic array which I build from an input file. When it finds the user-input string, I wa...
[2 replies] Last: Looks like you need to increase your compiler warning levels, and fix ... (by jlb)
by Ausha
operator overloading
 
Hi, having trouble with understanding operator overloading, everywhere there is theory explained but where it should be some more precise explanation always is...
[3 replies] Last: Very nice^^ Please mark your question as answered ;) (by Gamer2015)
Error C2678?
 
So I have the following code: template<typename T1, typename T2> class Pair { public: T1 a; T2 b; Pair() {} Pair(const T1& a, const T2& b) : a(a...
[16 replies] Last: Ah, I see. Well, I think all my questions have been answered, so thank... (by RotatingAxis)
by bpc123
Not exiting While loop
 
Hey guys. This is a portion of code that I've been trying to fix, and I know I'm missing something blatantly obvious and I've recreated this same thing with a s...
[1 reply] : You exit the while loop only if both conditions are false, so you need... (by ats15)
conveting string to decimal
 
In my project i have to take the string valve and convert it into float for example 100 will be 100.00 100.0012 will be invalid 100.00 will stay as it is ...
[2 replies] Last: you will also need to use a fixed declaration before it cout << fixed... (by sly858)
Deep copy and operator overloading
 
Hi, In main I instantiate two Polynomial objects -- p1 and p2: int main() { const int SIZE = 3; Polynomial *p1 = new Polynomial(SIZE); Polynom...
[3 replies] Last: If you don't use pointers, you don't have to worry about this crazines... (by LB)
Reference question
 
So I was reading my book and it listed this piece of code. The first piece of code is in the book and the 2nd is just my test on the piece of code. I am curious...
[2 replies] Last: That makes sense. Thank you TheIdeasman and you were correct in what I... (by cppnoob25)
Strings supposed to get stored in vector, then gets printed. It's not working...
 
#include <iostream> #include <vector> using namespace std; class Message { public: Message (); Message (string, string, time_t); void changeSubj...
[1 reply] : This code cannot compile because you have not defined your class const... (by LB)
by Ganado
Shadowing with 'using' declarations
 
I'm sure we've all be told about how using "using namespace ____" can be bad in a global scope. I had a question about the use of locally "using X = Y;" and w...
[6 replies] Last: > you should not redefine the name 'Coordinate' to be some other struc... (by ne555)
February 2015 Pages: 1... 45678... 26
  Archived months: [jan2015] [mar2015]

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