Beginners - February 2018

Printing a minimum value from an array in a text file
 
Hi there, I am trying to have my program print an array and also print the minimum value, all from a text file called numbers.txt I have successfully print...
[2 replies] Last: Thank you so much, this helps a ton! (by deftpaw)
by sidvas
Not getting results i want...
 
I have a assignment for class and it goes like this... Write a program that asks for the user’s height, weight, and age, and then computes clothing sizes acc...
[2 replies] Last: You're a lifesaver thanks ne555! (by sidvas)
FILE IN OUT probelem
 
W+ dose not mean i can read and write the file in the meanwhile?i use printf("hi") to detect whether the file has been read,but the result is not.Therefore,can ...
[5 replies] Last: In that case I don't understand the problem. Sorry. (by Peter87)
Reading all values from one variable with ifstream
 
I am in search of how to read all values from one variable in a file. Say a file called items.txt and I want to read all the int size from this file. How ca...
[3 replies] Last: Check: (a) That the file opened (e.g. assert(read) or read.good() or !... (by lastchance)
by bruin4
Calling class object in another class constructor
 
I'm trying to write a code that looks something like this: class Foo{ ... } .... class World{ public: World(int a, Foo first, Foo second); ...
[1 reply] : class Foo { public: int x; }; class World { int a; int b; ... (by Repeater)
Read matrix from file
 
Hi, i want to read a matrix that can take double values but my program is crashing, can you help me please? Thanks! Here is my code: void Matrix::Load(char* ...
[4 replies] Last: As far as using "dynamic" memory I suggest something similar to the fo... (by jlb)
Declare a Variable - then use it in System Call
 
Team... Say my user gives a variable; can I use it in a system call? I have tried with no love - so basically I take the user input and make a shell file ...
[5 replies] Last: depending on what you are actually doing, it may be worthwhile to have... (by jonnin)
c_string or const char?
 
Hello, it will not allow me to enter Line numbers, or even preview it at all. #include <iostream> #include <fstream> #include <string> using namespa...
[8 replies] Last: Yes, it should be from the input file (by Andre20)
how to define a virtual to_string method in C++
 
I want to make a virtual to_string method for a base class called Item which is the base class for the derived class Book. In Item I have several fields: ...
[3 replies] Last: I'd think again before doing so, as it creates some high complexity wi... (by benhart)
Having trouble with menu
 
I am making a program that asks the user to choose a selection off of a menu, if the choose "1", an addition problem is displayed. If they enter -1, it should r...
[2 replies] Last: Look at your if statements. = is for assignment == tests for equality.... (by Ganado)
Linked Lists [SOLVED]
 
I'm trying to work through a tutorial on linked lists. I've typed in the code exactly as it was given, but for some reason, only one node is being output. ...
[4 replies] Last: But if head is null, line 73 should never be executed, yes? Correct,... (by Ganado)
Multiplying each element of an 5x5 2D array by 2
 
Hello, i am having a hard time writing this question out into code. Multiply each element of a 5x5 2-dimensional array by 2 and display it. The code i curre...
[7 replies] Last: this won't work on 2-d pointer allocations, but 2d explicit arrays lik... (by jonnin)
Composition QUESTION
 
Hi, may I know if there is a way to B object without calling A object beforehand? class A{ private: int attackPower; public: void setPowe...
[6 replies] Last: I'm not going to write your code for you. You already know how to wri... (by MikeyBoy)
error
 
case label does not reduce to an integer constant What does this mean.. sorry i'm a beginner #include <iostream> #include <stdlib.h> using namespace std; ...
[2 replies] Last: ok,thanks alot sir :) (by mister2018)
boost : server tcp (mode synchrone)
 
Hello everybody, I succed to make a server (tcp) with boost, and I can communicate between my server and my client. But when my client is disconnected, my se...
[1 reply] : the exeption return read: End of file. I don't understand what is goi... (by cosmoff)
by mnai
Debugger not going to breakpoints when stepping over
 
Everytime i try to debug the loop in FindMaxSalesIndex with break points it just starts at the beginning code of my main.cpp file and doesnt even get to Functio...
[1 reply] : i try to debug the loop in FindMaxSalesIndex The function FindMax... (by Repeater)
Double variables being truncated
 
Hello I am new to the programming community. I'm writing a code to calculate gym fees over years and I'm experimenting with loops. I have come across an issue...
[4 replies] Last: I knew it was a stupid mistake of mine lol. It works now thank you (by Brandon110)
by mnai
Setw not lining up correctly
 
I'm using an input file which reads Jane Smith 100 Rose Diaz 200 John Williams 150 Felicia Johnson 250 Ron Davis 75 I am trying to outpu...
[3 replies] Last: Actually i switched it to Right instead of left and setw(7) and it loo... (by mnai)
Need help.
 
Add a for loop that will:  generate a number of 1's and 2's as requested by the user  add up the number 1's and 2's generated and store the values in va...
[1 reply] : So whats your question? Please, when looking for help ask a specific q... (by joe864864)
by zapshe
Why Wont this Code work properly?
 
Now, I'm sure there is something really simple and stupid I just didn't realize - I just started C++ a day or so ago. The problem with this code is that no matt...
[9 replies] Last: Ah, thanks Ganado - That let the program run smoothly. That line of co... (by zapshe)
February 2018 Pages: 123... 28
  Archived months: [jan2018] [mar2018]

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