Beginners - December 2012

Sorting? Or Searching (1,2,3,4,5,6,7)
 
So this is my code up until now. I want to put in a search option however I don't know what type of search is the most efficient and no clue how to implement. C...
[133 replies] Last: int x = array ; int i = top - 1; int j = bottom + 1; ... (by faieq92)
do while loop
 
Print the sequence using do while loop. * * * * * * * * * * * * * * * *
[4 replies] Last: That's not a do-while loop, though. (by Athar)
CMD
 
How do you tell a project to output things using cout to the command line? When I 'run' my project (that has almost literally nothing in it besides "cout<<"Hell...
[5 replies] Last: CTRL+F5 will run it without the debugger, and will hold the console op... (by Stewbond)
by Ch1156
How do i put a vector in a class?
 
I tried putting a vector in my class but it wont let me do it it keeps giving me errors. here is my code: #ifndef PLAYER_H #define PLAYER_H #include <...
[10 replies] Last: In the constructor, you need nothing, it's a class and it gets automat... (by S G H)
SDL Mob Class Remake
 
Well this is my remake of my last topic, which is buried under 100s of different topics now in the General C++ Programming fourm. Well here it is: I made a S...
[14 replies] Last: Oh :D Thanks!!! (by closed account N36fSL3A)
by Aceix
Easy to solve problem about rand()
 
Why does this give me the same number every time? ie: 3 string fnRandom() { srand(NULL); int nTemp; nTemp=rand()%9+1; if(nTemp==1) {return "...
[6 replies] Last: Thanks for your help! It makes sense that it is not needed to call sra... (by Rayquaza4096)
dynamically allocating array
 
I still dont understand pointers and references really. I found this segment of code somewhere on the forums. I was trying to convert it to a function to help l...
[8 replies] Last: Yeah, exactly, that's it! The second code also had a memory leak. (by S G H)
Simple calender program.
 
I am a calender program which should look like this. S M Tu W Th F S 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 23 24 ...
[3 replies] Last: #include <iostream> #include <iomanip> using namespace std; //PROTO... (by princemoon)
wrong in sort function
 
Hi, This Program shows total salary for each employee but after sorting in sort function It shows dumb salaries. where is wrong in sort function? #include <con...
[8 replies] Last: Because you can't initialize it that way. May use strcpy() or make i... (by ne555)
help me with iterator declaration!
 
1 #include <iostream> 2 #include <string> 3 #include <vector> 4 #include <sstream> 5 #include <utility> 6 using namespace std; 7 8 tem...
[4 replies] Last: [quote=cppreference] template<typename T> struct S { template<type... (by Catfish3)
functors!
 
I compile the following code, suggested by someone, but i get the following compilation error: sort_ba.cpp:8:27: error: passing ‘const bankAcct’ as ‘t...
[4 replies] Last: @jinanzhaorenbo Because the comparison function is not supposed to mod... (by Peter87)
help me with functors
 
Hi, the following is my code, i have two questions: first, in line 7, why can't i make ba1 and ba2 to be reference? second, there are some standard comparis...
[4 replies] Last: why must i put 'const' in this case? (by jinanzhaorenbo)
by DPA
Help Me!!!!!!!!!!
 
Dear All I am making a 2-player tic-tac-toe game in c++ (compiler: turbo c++ 3.0) but my code just refuses to work. The program bombs every tiume i try it. ...
[6 replies] Last: no turbo c++ 3.0 does not support namespaces. I know that my compiler... (by DPA)
converting one type to another
 
i see numerous different ways of converting one type to another. static_cast<int>(some_float) will convert the float to an int, but yet it doesnt convert for ...
[6 replies] Last: well the str to char i used the same method as char to string char C... (by metulburr)
i/o problems
 
void SaveData(Details Data , int size){ ofstream DataSave("test.txt"); if( Datasave.is_open() ) { for(int i=0; i<size;i++){ Da...
[1 reply] : It doesn't know what the class "Details" is. Its not a predefined typ... (by pogrady)
Logical OR isn't working Properly
 
Hello (: I'm learning C++ obviously and my friend let me borrow his C++ book from school called "Beginning C++ Game Programming". Anyways I'm on Chapter Two and...
[2 replies] Last: wow, simple fix. thanks a lot. I need to be more cautious of my errors... (by dValdriz)
by Kovs95
Fun with Functions
 
Write a function titled say_hello() that outputs to the screen "Hello" ★ Modify the function so that it takes an integer argument and says hello a number of ...
[11 replies] Last: Ah I used "cout << hello" before but I didn't have the loop right! Tha... (by Kovs95)
Resize my array
 
Hi I'm new in C++ so anybody can help me of resizing my array? I want to read a txt file and store it in an array: //Load polygon points string data ; in...
[2 replies] Last: Arrays can't be resized (they can only be recreated with a new size), ... (by Cubbi)
little help plz :)
 
when any console application finishes in c++ it types "press any key to continue ... " and it waits me to press any key to close what should i do if i want to c...
[13 replies] Last: if you didnt put "press any key to continue ... " in your program, the... (by metulburr)
Base-10 floating point data types
 
Is there any way (library, ecc.) to replace the float and double data types with other base-10 ones to avoid the floating point error?
[6 replies] Last: Does it make any difference the fact that I have the LLVM GCC? Or its ... (by fpiro07)
December 2012 Pages: 123... 65
  Archived months: [nov2012] [jan2013]

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