Beginners - February 2012 (Page 57)

help with code
 
im trying to develope a program that determines gross pay not including overtime. Pay rate must be between $1-$100 The tax rates are as follows: >= 2500.00...
[2 replies] Last: Wow this is rough. Are you taking a class for C++? Or reading a book/t... (by ResidentBiscuit)
cannot include vectors
 
Hi everyone, I am just a mere beginner in c++. I am trying to include vectors for one of my school project. Bu it seems, i dont have the vector.h file in my in...
[2 replies] Last: It's just #include <vector> no ".h"; in fact, If you're writing C++ ... (by Mathhead200)
by Rave
dynamically allocating pointers?
 
i have two questions, can you dynamically create a pointer, what i mean is: //something like this int **p= new *int; // sorry second question, int *...
[4 replies] Last: // Look at the type following the "new" keyword. This operation allo... (by Mathhead200)
Void* arithmetic
 
Hello everyone, For a school project I am working on, I must use an array of unspecified objects: void* voidarray; In addition to this pointer, I...
[1 reply] : I guess you could do voidarray2 = (char*)voidarray + offset; ... (by hamsterman)
overloaded >> operator function not working right
 
I have an overloaded extraction operator function that allows me to enter information for the member variables for my class. The problem i have is that one of t...
[2 replies] Last: #include <iostream> #include <string> using namespace std; int main(... (by histrungalot)
What am I missing in this second function?
 
I am pretty terrible with passing parameters, and I could use some help. My program reads in from a file and uses the numbers to manipulate an array. I have s...
[2 replies] Last: I think the statement j<0 in your for loop is never true, since yo... (by biaspoint)
Warning: Pointer Return Function
 
Hello, I keep getting an warning because of this: int* input() { int temp ; ifstream fin("data.in"); fin >> temp >> temp ; fin.cl...
[1 reply] : You are returning a pointer to something on the stack which is bad. S... (by histrungalot)
Please help with this code.
 
My class is having us make a class in a separate header file, use the prototypes in a separate cpp file from where main is. The data has to be read from another...
[4 replies] Last: Not knowing what the total project is, start small and read in the con... (by histrungalot)
What is the point of declaring a vector length?
 
When initializing vectors, why declare their length? Is there an advantage to this? std::vector<int> numbers(10); Why not just std::vector<int> num...
[4 replies] Last: Thank you! That is clear now. (by johnhoffman)
by Zeph78
Need some help and info. about buffer
 
Hey guys I was wondering if its possible to bounds check the buffer like: #include <iostream> #include <cstdlib> #include <cstdio> #include <fstream> #inc...
[1 reply] : Since your code explicitly determines the size of your buffer "char sB... (by collator)
Formatting Output
 
How do you get the proper output of a variable, to only one decimal point, and not have the fractal number rounded. Also I would like to do this only using cout...
[4 replies] Last: The floor didn't help so far, I looked up a bit on truncation, it wou... (by Wisely Done)
Class Issue
 
I'm fairly new to C++, so to learn a bit through practice, I decided to make a simple little RPG-like turn based battle system. This isn't the exact code, but i...
[1 reply] : Instead of void attack(int &a) where you are passing an integer, you... (by Wisely Done)
My command line calculator problem(s)
 
ok my code is: #include <cstdio> #include <cstdlib> #include <iostream> #include <math.h> using namespace std; int startup() { system("title ch...
[6 replies] Last: Not sure if it works, but try using stringstream. Something like this... (by Wisely Done)
Store a int with a name specified while running the app. ...
 
Lets say I have: string i; cout << "str: " << endl; cin >> i; Now I want to create a new int, inside the application, with the name of the value of ...
[3 replies] Last: That's a good question with plenty of practical uses. You can simul... (by closed account 3hM2Nwbp)
Class name student
 
I dont know what to do with this problem, I dont even know where to start. Can someone please lead me through it? Create a class named Student that has three...
[4 replies] Last: I know that. But how do you learn how to do something if you dont know... (by ProgrammingProblems)
Linked Lists
 
Upon compiling my code I am getting the error: List.cxx: In function 'void build_list(std::ifstream&, char*)': List.cxx:72: error no matching function for call ...
[3 replies] Last: I tried using the typedef everywhere and it works now, thank you for t... (by Yellowhottub)
getline(ifstream, string)
 
One more question: I have the following file: AIRPORT GND TWR ARR DEP CLNC APRN EHAM 121.7 119.22 121.2 119.05 121.97 121.65 OMDB 118.35 118.75 124.9 124.45 ...
[4 replies] Last: Yes, the file was open. Edit: No wait.... I added this line after... (by Stewbond)
Write a program that accepts c string input
 
I need help with this programming problem. I have no clue what to do, please help me. Where do I start what needs to be written? I am not a programmer and I can...
[1 reply] : Have you gotten input from the user into a char s ; before? Have you... (by Duthomhas)
Calculating Gravity
 
So far I have a particle simulator that puts 10000 particles randomly dotted around the screen and I want them to move towards a gravitational centre (0, 0). As...
[2 replies] Last: Thanks very helpful. I had already set up a data array and loop but us... (by closed account 2NywAqkS)
About linking
 
Hi, I am new to c++ and also learning makefiles now. I have a concern about something, here is my makefile: IDIR :=include CC :=g++ -Wall CFLAGS:=-I$(I...
[11 replies] Last: There is some difference between the two. http://www.gnu.org/software/... (by Peter87)
February 2012 Pages: 1... 5556575859... 64
  Archived months: [jan2012] [mar2012]

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