Beginners - September 2019 (Page 6)

Reading a file in C++
 
My engineering computations teacher gave us an assignment that requires the program to read the text in a text file. The text in the file is a column of numbers...
[4 replies] Last: Okay, so why don't you give it a try? In the code you posted I see no ... (by jlb)
Count and Display a value>0 but <1
 
Question is in the title for(int index = 0; index < a.capacity( ); index++) if(a > 0) { indexCount++; ...
[4 replies] Last: Ok I see what I was doing wrong. Atoi converts string to int not doubl... (by sadCoder)
Amount of words in file
 
I want to find amount of words in my text file. But if on the end of the line is my program stop work correct. How to stay away of this problem. Sorry for que...
[1 reply] : If I may, I would just say scrap what you have and just use cin's >> o... (by Ganado)
I just started writing code.
 
Write your question here. I just started writing code. Not sure where to expect help from everyone.Tks. #include <cstdlib> #include <iostream> ...
[2 replies] Last: Hello dotkickpra, There are many different styles for writing code an... (by Handy Andy)
by colt
Initializer list with inheritance
 
Hello. I wish to create a constructor that simultaneously uses a initialization list and calls the constructor of the base class This is what I tried to do ...
[7 replies] Last: @lastchance: search for projective space this allows you to represent ... (by ne555)
Error in If else statement
 
Hi everyone, I new to C++ and seeking for some advice from c++ experts here for the following task. This post is a continuation of my previous post (http://www....
[8 replies] Last: Hi mbozzi , furry guy and lastchance , I had fix my code ... (by sarah1993)
file parsing
 
I have the following file in the format. Date : Wed Jul 26 14:52:51 2017 **************************************** Startpoint: reg_4A ABSC DUAH ...
[1 reply] : http://www.cplusplus.com/doc/tutorial/files/ http://www.cplusplus.com/... (by lastchance)
by cash
loop not exiting
 
For some reason when I enter -1, my loop is not exiting. #include <iostream> using namespace std; const int N =10; int main() { int i,j,n...
[3 replies] Last: ... (by Duthomhas)
vector size changes in and out of function
 
I created a vector "entities" inside the object "_main" to hold members of a struct "Entity" that were created by other classes. When I use _main.entities.empla...
[2 replies] Last: Oh, duh, lol, thank you you're a life saver. Still getting used to the... (by ForestLapointe)
putting together iterator, std_max and lambda expression
 
Hello I'm trying to find the biggest area size (width * height) of a list of objects inside a vector, and then modify the found object. Uo to now I have this ...
[3 replies] Last: oh, I see. I tought std::max could return a reference to an element, a... (by Stauricus)
File IO and Struct
 
I'm currently writing a program that consists of displaying students' ID, Name, Course, Credit, and Score. The data is all in this text file: "StudentRecords...
[2 replies] Last: That seemed to fix my gradepoints error and the structure of the outpu... (by Orion98)
How can I add iteration to my code?
 
I have a text file like this: {4 <1,-1,-1> <1,1,-1> <-1,1,-1> <-1,-1,-1>} {4 <1,3,-1> <1,1,-1> <1,1,0.5> <1,3,0.5>} {4 <1,3,-1> <-1,3,-1> <-1,1,-1> <1,1,-1>}...
[2 replies] Last: dear "salem c" so many thanks for your answer. (by leelion)
printing pow
 
At line '25', I have the following error which I'm not sure how to resolve. The error is commented. I would appreciate it if someone could offer some guidance a...
[3 replies] Last: > A =pow((P *(1+r/n)) (n*t)); Pow takes two parameters, you forgot a c... (by salem c)
Change the value of a const variable.
 
Hello! Despite of the "const" in the variable declaration, why can't I change the value of "x" if did that casting to(int*)? The address of "x" and the content ...
[2 replies] Last: A program that modifies the value of an object declared const has un... (by mbozzi)
Cout and char
 
Im trying to print a single letter grade in this program. But I keep running into issues with cout not printing the contents of my char variables. How should I ...
[3 replies] Last: Thanks alot to both Andy and Highwayman. You're answers are the type o... (by Arcad31a)
Delete an element in an array list
 
I am attempting to delete an element in an array version of a list. When I use the function, it deletes the element, but only outputs one more element right aft...
[12 replies] Last: I figured it out. The for loop was a better option. Thanks for the hel... (by closed account jEb91hU5)
Question on time complexity!
 
int a = 0; for (i = 0; i < N; i++) // Here the order is N { for (j = N; j > i; j--)// Here J is decrementing from N + (n-1) + (n-2)....0 So: n(n+1)/...
[6 replies] Last: This equation is for sum of series numbers from 0->N. Sure it is. So... (by jonnin)
How can i approach this problem. (1,2,3)
 
write an algorithm to extract all nouns from random text. The biggest problem with this is there are almost infinitely many nouns that can exist, so a dict...
[47 replies] Last: Well, another rage quit. I did not expect that... On the original top... (by Duthomhas)
Code::blocks 17.12 does not on C++
 
Hello, I installed code::blocks 17.20 from codeblocks.org, exactly 17.20 mingw.setup.exe, and it worked perfectly on C. Now, I want to learn C++, and I open a ...
[5 replies] Last: If it is by Malik, then it is bad anyway. /opinion If you have good a... (by Duthomhas)
File isn’t changed.
 
I have a class called 'SaveStream' that takes data and saves it with a name next to it as a label, but when I attempt to save something using my 'store_as' func...
[10 replies] Last: Hello highwayman, I started testing your revised program today. Ended... (by Handy Andy)
September 2019 Pages: 1... 45678... 13
  Archived months: [aug2019] [oct2019]

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