Beginners - March 2009 (Page 4)

infinate while loop
 
hey, im sure this is a really simple problem but im baffled as to why i get an infinate loop if a character and not a number is inputed using this code: do ...
[2 replies] Last: I would expect c1 to be a char, and compare it against the characters ... (by seymore15074)
counting amount of html comments in text file
 
So I have managed to get my program to tell me how many characters and how many lines are in the file, now I need it to tell me how many html comments are in th...
[2 replies] Last: You can use istream::get http://www.cplusplus.com/reference/iostrea... (by Bazzy)
by Andre
get line troubles in Basic Input/Output
 
Okay, when I do this it works: -------------------- string mystr; float cost=0; int quantity=0; cout << "\nEnter Cost: "; getline (cin,mystr); stringstre...
[3 replies] Last: Thanks again eker676. No doubt you'll see me around the beginner's fo... (by Andre)
by AndeM
C++ Function with Sring Return
 
I'd like to write a class member function which takes no parameters but returns a string. It would be used to return formatted text containing values of member...
[4 replies] Last: I know that. Sometimes you have to assume that everyone is stupid. I... (by eker676)
question about .h ,about the compiler
 
#include <iostream> #include <conio.h> #include <windows.h> using namespace std; int main() { SetConsoleTitle("Hello"); cout<<"Hello"; ...
[4 replies] Last: Even if windows.h is not part of the C++ standards, the angle brackets... (by Bazzy)
Counting characters in a textfile
 
Hi guys! A program I am writing needs to be able to count how many characters are in a file. I have managed to get it to count the amount of lines, however I...
[4 replies] Last: Thanks guys got it working :). x (by mat1989)
by sobi
Array of random integers in C
 
I'm working on a problem here.It says to write a program that creates an array of 100 random integers in the range of 1 to 200 and then using the sequential sea...
[3 replies] Last: thanks for all the replies and post (by sobi)
by masiht
inline and not inline function
 
Can anyone please tell me what is inline and not inline function ?
[5 replies] Last: For most compilers inline does not mean "you must inline this func... (by Bazzy)
by Sabal
sizeof()
 
Hello, I am new to C++ and I recently came across "sizeof()" and I am confused to whether this is a c++ command, or if it needs to be defined somewhere. basical...
[3 replies] Last: sizeof is an operator and it returns the size of a type or a variabl... (by Bazzy)
Problem with descending order code?
 
I have been having trouble with pass by value, and that is what this assignment is aimed toward. After the code executes, 4 numbers print out, followed by a lon...
[2 replies] Last: You can use STL algorithms to sort easily http://www.cplusplus.com/re... (by Bazzy)
sqrt() nan problem
 
Hi all I am practicing with user defined functions and in this case I had to write my own sqrt function I know that somehow I should take into account that...
[4 replies] Last: That's what I was trying to understand...if it was compiler dependent ... (by andrewt)
HOW TO CREATE FILES...
 
HI EVERYBODY, I AM NEW MEMBER, I NEED A LITTLE HELP HOW CAN I WRITE A PROGRAM THA READS A NAME FROM KEYBOARD AND CREATES A TEXT FILE OF THAT NAME ...
[2 replies] Last: thanks gogo (by willscpp)
Include .png in executable
 
Is there a way to bundle a PNG image (or any other file) into the executable itself, instead of having to distribute 2 separate files? I'd like to use that imag...
[16 replies] Last: Thank you very much! (by user name)
Telling apart numerical values from letters
 
Hello everyone. I'm doing the c++ tutorial found on this website and I'm making this simple program, adding/changing it as I learn new stuff from the tutorial. ...
[7 replies] Last: But I did try to leave it empty, and I got some errors. Though I just ... (by Em3rgency)
My bitset
 
For practice, I tried making my own bitset. I noticed, that the STL bitset has two operator overloads, a const one that returns a bool, and a non const one tha...
[4 replies] Last: N / 8 + !!( N % 8 ) !!x is a clever programming trick, given an int... (by jsmith)
by Solmi
Using Input String to Call Function with Same Name
 
Is it possible to call a function based on a given string? For example: #include <iostream> #include <string> using namespace std; void male() { cout...
[5 replies] Last: What you are trying to do is common. Use a lookup table. #include ... (by Duthomhas)
by mudd2
Saving c++ into a .txt file (1,2)
 
Can anyone explain the easiest way to save a file?? And to load it as well... Or can anyone point me to a tutorial about this?? Thanks, I'll really appreciate i...
[21 replies] Last: Thank you very much sir eker676 and for the rest of those who helped m... (by mudd2)
New Craps Game (1,2)
 
I'm an amateur user of C++ so bear with me if my code offends you in some fashion. I'm developing a craps game.... Towards the end of the program I would li...
[24 replies] Last: You'll get better, it just takes time. ;D (by eker676)
delete from a vector
 
Hello there! I'm trying to do some graphics and I'm using vectors This is a function I'm using to object balls from the screen when I press the mouse: ...
[5 replies] Last: Note that if insertion and removal of elements in the middle of the co... (by seymore15074)
by jaydr
making output look nice
 
i have a program where i what the out put to have the headers horizontally and the out put centered underneath. i have it figured out for the max numbers that w...
[2 replies] Last: Thank you eker676 i have tried your 1st solution and it works great ju... (by jaydr)
March 2009 Pages: 123456... 29
  Archived months: [feb2009] [apr2009]

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