Beginners - September 2016

Help accepting a file from a user
 
How do you accept a .txt file from a user in which you don't what file that person will input? This is what I have so far. I want the user to input the .txt fil...
[7 replies] Last: You should get rid of the headers you aren't using. http://www.cplusp... (by integralfx)
by JmmL
i cant understand this
 
i copied a lot of code for practice and i come up with this problem. why is the purpose of the "&" next to the first vec3 i deleted it and still works and ...
[4 replies] Last: Please use code tags. http://www.cplusplus.com/articles/jEywvCM9/ ... (by integralfx)
by Hengry
Copying data from one dynamic array to another
 
I have to create a larger array doubled in size if the initial array is full, the copy all the elements of array over to the new array. After i created the new ...
[5 replies] Last: Before this code the array points to memory block A. On line 3 temp st... (by keskiverto)
by stav
assembler?
 
I'm trying to understand how the compilation process works what I've understood so far is that first we have the pre-processor which i can image just looks th...
[1 reply] : is there multiple assemblers made by different people? Yes, there ar... (by Cubbi)
How to write a Repetitive Function
 
How to write the a repetitive function that takes two parameters, A and B, and prints all the numbers from A to B inclusive. Thank you!
[4 replies] Last: Got it! Thank you Anon! (by Dora0303man)
Functions + Structures = Not storing?
 
Hi guys! So far I have had a great experience in this forum with all the help one is able to receive it makes learning C++ very enjoyable. My question was w...
[7 replies] Last: You're mixing two idioms here and neither one is correct. 1) If you... (by AbstractionAnon)
Problem with vectors
 
Hello, I need to implement function that calculates sum of the first and last item in the vector, then the sum of second and second-last item in the vector, an...
[2 replies] Last: Thanks very much! I just changed *(end-i)--->*(end-1-i) and now it wo... (by beginner12345)
enum without name
 
Dear all, Reading some codes, I realize the following code: enum {On, Off}; enum {SZ=80}; Can you please, explain the meaning of them. I only kn...
[3 replies] Last: Thanks for the correction. (by AbstractionAnon)
by mmgh
Memory leak
 
Hi, I am writing a program in c++. The program is killed by id 9 after more than 2000 steps. Valgrind was not very useful to find the leak. Dose anyone ha...
[no replies]
by dana18
error at cout
 
I want to obtain all the subsets of a set . I tried this code but I have an error at "cout<<subset " and i can't figure out what is wrong. void displa...
[3 replies] Last: Your subset is a vector<vector<int>> you can only print a single eleme... (by jlb)
cout every line in a csv file?
 
So if we have a file that contains 5 elements each line 3 4 5 6 NY 6 7 8 9 NJ 1 2 3 4 WY 4 3 2 1 NC I would write it as while(!streamname.eof(...
[3 replies] Last: Wikipedia: In addition, the term "CSV" also denotes some closely rela... (by keskiverto)
by fg350
yes/no question
 
Hi guys, so in my program I need the user to input a "y" or "n" as a yes/no response, but I need the response to be counted as a numerical value. For example, i...
[7 replies] Last: If you want them as a numerical value, what I would suggest is somethi... (by DrZoidberg)
Need help with array excercise
 
Hello everybody. I'm doing this exercise, and I've gotten as far as to sorting.. I have some problems though as described below the exercise. Pancake Glut...
[2 replies] Last: Hello Elerobo, First you should initialize all your variables to avoi... (by Handy Andy)
struggling with while loops
 
I am trying to write a code for my class that uses data from a file that contains two numbers, 100 and 200. My assignment is to write a program that counts the ...
[12 replies] Last: The first number between the two limits is first number + 5 since fir... (by AbstractionAnon)
Including header file causes error, while including cpp file does not
 
Was playing around with code from a class, making the input into a class, the class works properly when it's inside the smae file as main, but when I place them...
[12 replies] Last: @blacker - No. One should NEVER #include .cpp files. They should b... (by AbstractionAnon)
expected unqualified-id before '{' token
 
I've been trying to figure this out for two days but I can't. I keep getting a 55:1: error: expected unqualified-id before '{' token 63:1: error: expected unqu...
[2 replies] Last: Also, check the spelling of the function name in the definition. voi... (by wildblue)
by keima
for loop for aaaa and next line is b
 
I'm just getting started at for loop, what is the simple program for an output of: aaaa b b b b ..please help me with this thanks
[1 reply] : Assuming you want to print one char at a time, your going to have to u... (by SamuelAdams)
Is using nested namespaces bad?
 
I was wondering is using nested namespaces to organize the classes in my library is good programming practice? I was wanted to organize the classes like pack...
[4 replies] Last: The C++ Standard Library has multiple files that contain stuff within ... (by keskiverto)
Need help with while excercise
 
Hello guys! I'm currently doing this excercise: While( user == gullible ) Requires: variables, data types, and numerical operators basic input/output logic (if...
[5 replies] Last: [quote=SakurasouBusters]So after the user enters 10 numbers and the pr... (by integralfx)
by dana18
segmentation fault
 
If I test this function I have a segmentation fault and I don't know why. bool bitn(int n, int pos) { return (n >> pos)&1; } vector<int> so...
[2 replies] Last: The reason is that on line 18 sousens is an empty vector. So you can... (by coder777)
September 2016 Pages: 123... 34
  Archived months: [aug2016] [oct2016]

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