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

help needed with writing to a file
 
so im trying to read in the name of a vendor into an array of structures. and write the name into a file. doing this gets me an error i haven't seen before and ...
[5 replies] Last: my error was with my struct and not creating the struct variable. i so... (by sean shine)
by bdub25
Getting a error ...
 
I need some help here. I have a class #ifndef ELECTION_H_ #define ELECTION_H_ #include "base.h" #include <string> using namespace std; class elect...
[7 replies] Last: base::name is private I really think that means the base class (th... (by yelnatz)
Program Help
 
I'm still fairly new to program and was recently given a program i have no clue how to do. Please help me if you can. Put all the code in a .doc file and inclu...
[1 reply] : Read! http://www.cplusplus.com/doc/tutorial/classes/ (by yelnatz)
Collatz Problem Program
 
Hey guys, I am writing a program that needs to output the amount of times a negative number (1-1000) runs through the collatz conjecture. I have a working progr...
[7 replies] Last: So what I need to do now is find a way to make it terminate after it ... (by yelnatz)
by lengao
How to return multiple value from function to main?
 
Get user input should be done in a function. The function should read the product number, price per unit, and quantity sold and return them to the main(). Dis...
[7 replies] Last: Solved it. Many Thanks!! (by lengao)
Resizing a Matrix
 
Can't figure out why this isn't copying the matrix right. I get crazy numbers whenever I try. I even tried to just label all the entries as zero, but that didn'...
[2 replies] Last: Thanks for your help. I've gotten it to work, though I couldn't use an... (by Gulopey)
if/else
 
Hi every one i need help with my code, i believe that i have everything in order but just to be sure, I wanted another opinion, also i need help in trying to ge...
[2 replies] Last: Have you even tried to compile your code? Hint - It doesn't compile. ... (by AbstractionAnon)
Big O complexity
 
What is the time complexity of this: while(L1.contains(obj)) { L1.remove(0); if (L2.size() > L1.size()){ L2.remove(L2.size() - 1); } } Is it O(n) bec...
[1 reply] : Depends on the data structure of L1 and L2. If their remove(0) (or re... (by yelnatz)
by geran6
Convert value to clamped 0.0-1.0 float
 
What would be a reliable way to do this? I need to convert RGB components to float values between 0.0 and 1.0 so 0 is 0.0 and 255 is 1.0.
[1 reply] : if you know the component is going to be between 0 and 255: float v... (by Disch)
by Viridi
Before I start learning..
 
Hey everyone, I'm planning on picking up C++ fairly soon, there's a few things I'd like to know first though. I hope you guys will be able to answer the ques...
[5 replies] Last: Thanks a lot, guys. Your advice is very much appreciated. I've alread... (by Viridi)
lowest and highest number of a series
 
I'm having trouble, I want the inner loop to display the lowest and highest score. If I assign initial values for the high and low score, it won't always work (...
[6 replies] Last: No problems, have fun :) If it works as well, can you mark the questi... (by Guy Shapter)
Riemann Zeta Function C++ Program
 
Create a program to compute the Riemann zeta function for real values of x > 1. There will be two while loops in the program. The outer loop will allow the use...
[no replies]
Good for multi-thread program?
 
Hi, I am running a heavy simulation which takes time, its main structure looks like this: for(int i=0; i<1000; i++) { // repeat what's inside 1000 times ...
[4 replies] Last: Do each of the loops need to run in sync with each other? Is there an... (by closed account zb0S216C)
Converting decimal to binary using recursion
 
Hey all, I'm trying to write a program that converts a decimal number to a binary one. I have most of the program written, but I am having a little bit of troub...
[4 replies] Last: Ah calculating the remainder before dividing fixed it, thanks for the ... (by stack99)
c++ loop
 
Write a program that calculates the average of a stream of positive numbers. The user can enter as many positive numbers as they want, and they will indicate th...
[1 reply] : The simplest way to do it is to have three variables: justEntered, sum... (by Guy Shapter)
by LB
Template fallthrough
 
I read somewhere that template instantiation failure is not a compiler error and the compiler will keep trying instantiations until it runs out. I have no idea ...
[1 reply] : Are you talking about the SFINAE? http://en.wikipedia.org/wiki/Substi... (by S G H)
by qingze
How to read data from a txt file into an array HELP!
 
I wanna read a txt file like this 1.00518 2.01903 3.01139 4.01343 5.02751 5.99913 7.00011 7.99851 ..... and fill the array P with the data. I try to us...
[1 reply] : First off, you are always inputting the data into the first element in... (by Guy Shapter)
Project for class: inserting file of names and sorting alphabetically...HELP!
 
this is my assignment: A teacher has asked all her students to line up single file according to their first name. For example, in one class Amy will be in f...
[1 reply] : Strings can be sorted using the > and < symbols. This will allow you t... (by Guy Shapter)
by qingze
Help needed Reading data from txt file
 
I wanna read data from txt file with space divided each value like 1.00518 2.01903 3.01139 4.01343 5.02751 5.99913 7.00011 7.99851 8.99506 9.98015 10.9901 11....
[3 replies] Last: Thank you so much cire. Great help! Can I add you friend (by qingze)
Boost Threading iIssue
 
When I put boost::thread Thread; in my struct I get the error error C2248: 'boost::thread::thread' : cannot access private member declared in class 'boost::t...
[1 reply] : You can't default construct a boost::thread because the constructor ne... (by Disch)
February 2013 Pages: 1... 45678... 43
  Archived months: [jan2013] [mar2013]

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