Beginners - May 2012 (Page 45)

How to limit the input values must be integer?
 
Hello, I have a question about how to limit the input to the following program must be integer. here is the program, what should I add into it?? thank you! ...
[6 replies] Last: #include <limits> #include <cmath> #include <cctype> using namespace ... (by cire)
Union
 
All the addresses of the union variables should be the same: int main() { union x { int s; double f; char t; long r; ...
[2 replies] Last: It has the same address, but &char will result in cout using the << ... (by ModShop)
Linker error with constructor
 
I imagine the solution to this question is really easy but for some reason I can not figure it out. I keep getting a linker error and I know it has to be the c...
[3 replies] Last: If you get an unresolved external, it usually means that you declared ... (by BlackSheep)
Rounding numbers
 
I am currently using this method. #include <iostream> #include <iomanip> using namespace std; int main(){ double num = 12.456789; cout << num << '\n'; /...
[4 replies] Last: You would have to check specifically for negative numbers, if a number... (by ModShop)
Issues with placing a namespace in a seperate file
 
Im trying to organize some of my functions for a program that has become quite large. I want to use another file that holds a namespace 'Message' which wraps ar...
[5 replies] Last: Thank you so much! it makes a LOT more sense now. (by Need4Sleep)
Quick Question.. Passing one value from main & returning two values
 
I am trying to call a function from main(), passing one value to it and return TWO values, both the square of the number and the number to the power of three. ...
[2 replies] Last: Thank you very much for the help. I can't believe I missed that.. (by jasonp1978)
Why declare an overloaded operator in a class?
 
I tried the code #include <iostream> using namespace std; class Greeter { private: string name; public: Greeter(string name2) { name = na...
[8 replies] Last: I don't think that would work viliml. You would get an error that th... (by Stewbond)
Coding a Scientific calculator (Console based)
 
Hello As part of a personal project, I need to make a console based Scientific calculator. It needs to be able to add, subtract, multiply and divide a large a...
[8 replies] Last: Bump (by nerdycameron)
Cannot remove spaces from std string
 
Posted this in the wrong subforum, sorry. I need to remove commas and spaces from string but following is only removing commas: string b = "1, 2, 3,...
[2 replies] Last: Ah I feel very stupid now. Thanks! (by rozick1)
this pointer question!
 
Hello! I have googled alot and i find absolutely nothing on this subject. if i call a function this inside a class with the this pointer does it return from t...
[7 replies] Last: Sometimes, though, it's required. For instance: struct Base { B... (by closed account zb0S216C)
c++ vector question.
 
Two questions: 1. Does .clear() member function in a vector free() memory called by new? I wrote some code to check it out. I think the answer is no, bec...
[2 replies] Last: 1. Does .clear() member function in a vector free() memory called by ... (by guestgulkan)
string::copy help
 
Does string::copy allow me to copy a substring to another string?
[1 reply] : No, substr does. (by Athar)
by cshu
need help
 
Im making an array program but i keep getting these errors here is my program: //Hw9ShumateCedric My first array #include<iostream> #include<iomanip> #inc...
[3 replies] Last: how would i declare loadArray int loadArray(double* resist); ... (by Moschops)
Reading a character array from command line input file
 
Ok, so I've checked several forums here for help but to no avail. What I want to do is to read in a file name from the command line and then read from the fil...
[6 replies] Last: ROFL you actually emailed the professor... bwaaahahahahahahaha (by TACC)
What's The Difference Between malloc() & new?
 
Consider these two memory allocation requests: #include <new> #include <cstdlib> int *Memory(static_cast<int*>(std::malloc(sizeof(int)))); int *Memor...
[4 replies] Last: Thanks again, Cubbi, for your assistance :) You have my gratitude. ... (by closed account zb0S216C)
Help picking out decimals from whole numbers?
 
In C++, is there anyway to see if a number divided by another is a whole number or not, and have that number disregarded if it a decimal. For example, if I have...
[7 replies] Last: @andywestken using directive within function scope, so only the relev... (by Danishx83)
Need help with little things...
 
So I have gotten the basis of this down... I just need to add a few more things but I am unsure about how to do this. I don't know how I would go about deleting...
[4 replies] Last: I think JLBorges has pointed a good option because if at any time yo... (by Danishx83)
by rayne
Sequential Axcess File Help!!!
 
I have written code that accepts input from the user to axcess a SAF and display the information that is related to the input. It is numeric and it is not displ...
[6 replies] Last: Well, the obvious thing you're missing is a loop. It's not possible t... (by cire)
by arooj
Triangle Perimeter/Area Calculator Problem
 
I have a messed up perimeter value when I try to compute the perimeter, can someone point out to me what I'm doing wrong? //Ch14Lab3.cpp-calculates and disp...
[no replies]
by Neema
Top-down design to display tile pattern
 
I'm confused about how to fix my parameter declaration errors. I think I have a misunderstanding of what the "for" parameters are stating in void MakePattern(in...
[8 replies] Last: /* function definition */ void MakeLayer (int layer, int a_width) { ... (by cire)
May 2012 Pages: 1... 4344454647... 59
  Archived months: [apr2012] [jun2012]

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