Beginners - June 2008 (Page 3)

Whats wrong with this?
 
#include <iostream> #include <fstream> #include <string> using namespace std; int main () { string name; ifstream myfile ("example.txt"); if (my...
[2 replies] Last: Ty i edited it a bit and added a quesion its "Where do you come fro... (by Chrislee123)
initializer's list
 
what's the difference between: 1- return type function-name(): w(0), h(0) { //definition goes here } 2- return type function-name() { w(0); h(0) } being ...
[1 reply] : The first directly initializes the object. The second may or may not ... (by Duthomhas)
unexpected change of variable
 
Hello, I have a problem with global declared variable type INT called aa. After global declaration, I fill it with 0 in main() and after that,it is filled with...
[3 replies] Last: No problems, glad to help. (by Faldrax)
Question about constructors
 
Hello again, I have a question about constructors. The book I am reading references the "default constructor defined by C++". It says it is not nessecary to ...
[4 replies] Last: Thank you all for your time, I will define those in my code from now o... (by enduser000)
gettign hex code of a byte
 
earlier, I had posted a problem in which I was advised to look at it in terms of hex values and not binary values, so how do i do this in c++? As an example ...
[3 replies] Last: @Zaita, once again, thanks....!!!! (by ladesidude)
Comparisons in C++
 
int n1 = -1; int n2 = 2; unsigned int u1 = (unsigned int) n1; unsigned int u2 = (unsigned int) n2; // I said the result would always be 1 (...
[3 replies] Last: No worries :) (by Zaita)
Polymorphism? (1,2)
 
Can somebody tell me (in a simple way) what polymorphism is? How does it work? Any example? I'm still don't get it (Practically not theoritically). Than...
[21 replies] Last: My explanation has answered all of your questions? (by Zaita)
Making GUIs?
 
Ok, while trying to figure out how to make a GUI with C++ I came across a few terms that I needed to know. I tried looking them up, but the definitions were too...
[9 replies] Last: 1) Yes. But when you interact with any library you are using that libr... (by Zaita)
Correct the Mistakes Please
 
Here is the code Fill the defecieny in of this code how to import this to another file add also how to output it into new file #include<iostream.h> ...
[1 reply] : You use cin>>myQuiz.userAnswer; but the userAnswer is an array. You ... (by Mitsakos)
Not initialized problem?
 
the window that comes up while I am running my program is: Run-Time Check Failure #3 - The variable 'onemoretime' is being used without being initialized.
[1 reply] : That means that you didn't assign a value to the variable an tried to ... (by Mitsakos)
I have a problem in this code???
 
I am making a program that simulates an atm. I also put the error message at the bottom. #include "stdafx.h" #include <iostream> using std::cout; usi...
[1 reply] : I can't compile because the compiler cant finde the stdafx.h But also... (by Mitsakos)
casting char pointer to unsigned int (1,2)
 
I have found this forum to be very helpful in my (young) quest for learning C++. I have the following functions that I dont quite understand, what I do underst...
[24 replies] Last: That'd work fine. (by Zaita)
key number 5 and the '_' sign?????
 
Why the number keypad of the keyboards and the cell phones have the sign of underscore i.e. '_' on its key number 5 and how is that used and where?
[2 replies] Last: It is not the sign underscore... It is just used when you can't or do... (by Mitsakos)
bit shifting and bitwise operators
 
folks, I have a small problem understanding a function as to what its doing: I have run this program in C++. I will comment the lines of code as per my u...
[9 replies] Last: Zaita/Duoas, Thank you very much for the reply. I feel this is a s... (by ladesidude)
by Boman
Sorting
 
Hi again, writing a program to do selection sort: 1)input values from text file to array 2)sort array unfortunately, as usual, not going well. I believ...
[4 replies] Last: I rewrote it for you so yo can see what was wrong. #include <iostr... (by Mitsakos)
Can't terminate program correctly
 
#include <iostream> using namespace std; int main() { float students, individual, total; int count = 1; cout << "How many students do you have? "; ...
[2 replies] Last: Your variable individual is of type float, and you are entering a char... (by psault)
comments writing in sourcecode
 
Dear Sir, I am new to c++. I want to know about writng of comments in source code . It has been told that // method of writing requires writing of comment in o...
[3 replies] Last: If you use and ide your code will be colorcoded. This will give you a... (by Somelauw)
A weird switch issue
 
here is my code: #include "stdafx.h" #include "profileClass.h" #include "Gun1.h" #include "Gun2.h" #include "Gun3.h" #include <iostream> #include ...
[1 reply] : If profile.GunId is an int use: switch( profile.GunId ){ cas... (by closed account z05DSL3A)
by dman
A replace function.
 
Does anyone know where i can get a function that can take 3 strings and return a replaced version with all instances of the second string replaced by the thir...
[4 replies] Last: thanks :) Well, here it is for anyone else who needs a basic replac... (by dman)
by joe25
what does getline means?
 
hi.what does getline does and when and where shall we use it?? i was wondering if it have any relation with #include <windows.h>? i'll be grateful to anyone w...
[2 replies] Last: See http://www.cplusplus.com/doc/tutorial/basic_io.html for some more ... (by Faldrax)
June 2008 Pages: 12345... 13
  Archived months: [may2008] [jul2008]

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