Beginners - February 2016 (Page 30)

Does anyone see my errors?
 
my errors are: program2.cpp:70: error: ISO C++ forbids in-class initialization of non-const sta tic member `capacity' program2.cpp:98: error: prototype ...
[5 replies] Last: The initialiser of a constexpr object (of a literal type) is evaluat... (by JLBorges)
Need help with this program
 
Okay so the description says: for a given number write all sums of consecutive numbers. for example, if i enter 9; the program needs to say: 4+5, or 4,5 or what...
[5 replies] Last: Try having a variable outside the loop which you can aggregate the sum... (by TwilightSpectre)
Sorting not working
 
Hello :) I am making a simple program to accept the details of 3 students and to print the values as the user wants. So i have 3 main options and the 3rd option...
[5 replies] Last: Oh, sorry then. Different compiler, compiling on almost highest level ... (by naaissus)
by jp003
Need some help
 
I am unsure how to clean up this code the way it needs to be. This initial version of the program relies on treating each attribute of a song as a distinct...
[1 reply] : You didn't show us the new Song type so I have to guess a bit. I woul... (by Thomas1965)
Editing Existing Data
 
Hi guys, still new to C++ programming here but I am trying to copy an existing data from a text file to a temporary text file so as to rewrite the data in it an...
[1 reply] : #include <fstream> #include <string> bool copy_file( std::string src... (by JLBorges)
Undefined reference to function.
 
Hello Everybody! This is my first post here! Please be gentle ;) I am including a header file from another directory into my code which I write using codeblock...
[4 replies] Last: Thank you very much cire! I'll generate the libraries then. (by Silverwhale)
Basic c++ program problem
 
This program is supposed to act as an ATM, but the problem I'm running into is whenever the user inputs an answer, it only goes to withdrawal, and isn't working...
[4 replies] Last: You can put the part that asks for action in the loop and than execute... (by etrusks)
How to make it so you HAVE to insert the choices given?
 
So the player needs to say whether they will attack "head" or "body" how would I do this? Like you can type head or body now, but i want it so you HAVE to choo...
[1 reply] : cout << player1 << ", where do you strike?" << endl << endl; cin >> c... (by naaissus)
Difference in Style and Organisation
 
I have seen many code written as below: public: // (default) constructor dumb_array(std::size_t size = 0) : mSize(size), mArray(mSize ? new int ...
[8 replies] Last: Ok it sounds as though you are doing well, good luck in your future en... (by TheIdeasMan)
Help convert degrees to radians
 
Hi, I need some help writing this small function. It's supposed to accept a double value as degrees and return the radian equivalent. If the degrees is positiv...
[4 replies] Last: See http://www.cplusplus.com/reference/cmath/fmod/ (by helios)
if/ else if statements
 
This is for a CS homework assignment. When I run this program, for the first cout statement that says: "\nUsing logical operators to identify ranges:\n"... it d...
[1 reply] : Your question is unclear to me, however the reason it's displaying 0.0... (by TarikNeaj)
by rantiv
INVALID SLOT
 
I need to make an "INVALID SLOT" show up when a wrong input is entered in the single drop and multiple drop #include <iostream> #include <string> #inclu...
[no replies]
Functions
 
Hi all, I wrote this small piece of code, after executing the code I had this output: Inside the function: 2 Outside the function: 2 This is not what...
[2 replies] Last: http://www.cplusplus.com/forum/beginner/182122/ (by helios)
by tNK
Question
 
Hey everyone just a quick question. Say I have a integer variable that I will be using to store something the user will be inputing. So like - int x; c...
[3 replies] Last: pnoid but what I'm trying to accomplish is for the program itself to d... (by tNK)
by Haziq
Basic C++ problems
 
1. If my i=0, i get a correct input for pre_date as a start but when i increased the i, weird output coming out. The years should be 2012-2015. 2. How do i ass...
[no replies]
How to determine the min and max values from a list of numbers in a txt. file
 
How do I determine the min and max numbers from a list of numbers in a txt file?This is what I have that isn't working. I've figured out how to preform the oth...
[2 replies] Last: Holy Smokes Thanks so much for your help. I/we got it to work. (by a1ckunze)
Bid Tool
 
Good afternoon guys. I'm on working on an assignment about pointers and dynamic memory. This is what I'm asked to do: You have been asked to write a data an...
[no replies]
by ristic
Allocated pointer set to NULL
 
Hello there. I've got a question. So here is what i have: // in .h file static Class** vektor; // in .cpp file Class** Class::vektor = new Class* ; my q...
[6 replies] Last: I'm a little confused here. Your example code shows delete and the ... (by cire)
Calendar Program Offset
 
Hello, I'm working on a Calendar program that will display the calendar for any month during any year past the year 1758. The program will need to calculate sev...
[7 replies] Last: @jaykeblakk Can you explain to me why my way isn't working, and this ... (by whitenite1)
std::sort comparison object
 
Hi, as always I was doing an exercise and faced huge error message when I was trying to sort vector of std::pair<std::string, int> based on values of int S...
[2 replies] Last: Dude you are genius :) Thank you! I have to start spotting these thing... (by etrusks)
February 2016 Pages: 1... 2829303132... 46
  Archived months: [jan2016] [mar2016]

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