Beginners - December 2011 (Page 3)

question with if-else statement
 
i am a C++ beginner and stuck with the following problem.What's wrong with my code and how can i write the same thing by switch statement? #include<iostrea...
[4 replies] Last: Thank you very much!! (by garygao)
empty catch block
 
I've read that empty catch blocks are bad practice, but I have recently encountered a problem where one makes perfect sense. Since I am a beginner, I take this ...
[3 replies] Last: One valid case I can think of right now is in destructor code. More o... (by webJose)
Problem creating load
 
I am making a new game and i am a beginner in C++ I was trying to make a load function but the problem is that i need to define the fstream in the load() too ...
[2 replies] Last: How am i supposed to load the game??? It is not a variable. This is my... (by Donanza)
Are they one and the same?
 
New to c++ and just started reading Arrays and strings but came across a pointer declaration that i need cleared out. what is the difference between char * c...
[2 replies] Last: Consider that there is the case of char const * const myVar; = const ... (by eypros)
why i need to subtract 48 from every digit??
 
Hi all my program works it works like this u enter some string and my program summarises all digits in entered string but i have one question why i need t...
[4 replies] Last: suma+=niz -'0'; Now you don't have to ask (by ne555)
by sotbs
Over loading + operator to add 2 arrays and copy equal numbers once
 
#ifndef DARRAY_H #define DARRAY_H #include <iostream> #include <cassert> #include <string> using namespace std; template<class T> class DArray { T* list; i...
[8 replies] Last: My advice is not to overload operator+ unless it preserves its origina... (by moorecm)
whole no. and decimal
 
im trying to put my input able to get numbers entered in whole and decimal.because i need to increment it for the next process. The problem is my cin can onl...
[7 replies] Last: The printf format %d is for integers. I'm guessing 'a' is a float? (by moorecm)
by Ch1156
Cant read my .h file? (1,2)
 
I made a program and i made a .h file called VirtualKeys.h so that when i use a Virtual Key i wont have to define the Virtual Keys every time. There might be so...
[31 replies] Last: http://www.sfml-dev.org/ It was in the article. Alternatives are ... (by hamsterman)
by rushab
how to do this in c++ 3.0
 
write a program in c++ to input name (first name only) and age and print the output as: if name is "jack" and age is 17, then Jack is 17 years old. please ...
[15 replies] Last: char name =""; That's the same as: char name ; name = '\0'; ... (by Catfish)
what is the problem with this program
 
I don't know why this program doesn't work my c++ shows me that there is one error. the question is (Write a program that reads in the average monthly ra...
[7 replies] Last: I took the trouble to indent his code... http://pastebin.com/n7eFrMhB... (by Caprico)
problem with long double
 
hi in c++ i do : long double x=1.123456789; cout << x << endl; but this prints : x=1.12346 why? i use long double and so i expect this commands print x=...
[5 replies] Last: thanks (by ranjbar)
by jjzpgg
Error when using vector .find() member function
 
Hi all, So I have the following piece of code (truncated for clarity's sake): cout<<"Please enter the name of the app you wish to find"; cin>>AppSearch...
[3 replies] Last: My bad. find doesn't accept a comparison function. You need to use fin... (by hamsterman)
by seth23
getline error?
 
What is up with this? When I try to get the line as soon as I press a key it stops? Why is that? #include <iostream> #include <conio.h> #include <string> ...
[4 replies] Last: Umm getline and cin dont fit together I believe for cin which is is... (by sohguanh)
Defined operator error?
 
Here's the error I get when I run this : ====== Build started: Project: SDLProject, Configuration: Debug Win32 ====== main.cpp c:\users\aarons\doc...
[2 replies] Last: You are meant to make sure the tempImage != NULL after you do SDL_Load... (by Hippogriff)
by sch518
How can I make a timer for my simple game?
 
So I am making a small game between semesters so I don't forget everything I learned last semester. The game creates a pet and the user must feed and play with ...
[2 replies] Last: If you are doing it the console way, you have a problem, you most prob... (by sohguanh)
by Vickii
help please
 
I need a C++ function that has 4 parameters involving axis x1y1 x2y2 in the function it lets me to input (x1,y1) (x2,y2).from 1 point to the other it must be b...
[4 replies] Last: ciphermagi: Why have you given a link to this post itself??? Vickii: ... (by Caprico)
Problem with SDL
 
I'm trying to use SDL on CodeBlocks, it all worked out fine until I tried downloading the SDL Image, and everytime I try to compile something using SDL is alway...
[2 replies] Last: If your still having trouble I recommend you take a look at LazyFoo's ... (by Code Assassin)
by mj1709
a petite error.....can nyone plz? (1,2)
 
see i have a program, actually a project in which there are menus whch make u go from one page to another by means of printing & using the video memory) But aft...
[22 replies] Last: @computerquip so for learning purposes too we need to stick to the new... (by mj1709)
Problem with this maze game
 
#include <iostream> #include <fstream> #include <string> using namespace std; char **path; bool **exist; int ent_a, ent_b, a, b; bool route(int x, i...
[no replies]
Another way of achieving this sum?
 
Hi everybody I'm kind of new to C++ and I dont quite get this. So I have a code wich sums the values from an array and the it outputs the result while(i...
[3 replies] Last: You can make a class,....wait,...it might just more complicated... (by hentaiw)
December 2011 Pages: 12345... 47
  Archived months: [nov2011] [jan2012]

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