General C++ Programming - May 2013 (Page 12)

i want to improve my program -- what questions could/should i ask myself during the re-write?
 
tl;dr - i want to adopt good coding habits now. the below code was written under tight constraints. we don't do assignment post mortems in class to discuss "r...
[6 replies] Last: I think the last part should be ++i. or the other way around? Oop... (by andywestken)
Error :invalid types 'Double[int]' for array subscript
 
Hello, I am a beginner.I am getting 2 errors.Please help to solve them. The program first takes the readings ..then gives the average .After that it subtracts t...
[2 replies] Last: Also there is code tags (looks like <> on right of post creating/editi... (by MiiNiPaa)
help how to write code
 
i have given following exercise in my cpp book: Determine the roots of quadratic equations ax^2 + bx + c = 0 using formula x = -b +(plus-minus) (roo...
[6 replies] Last: Good.... i impressed..... (by Monicaceys)
UTF-8 String and Hash calculation
 
I use ATL and Visual C++ to write my program. I have need to POST certain form data to a web site. Since this is a banking/financial web site, they require the ...
[no replies]
Template specialization
 
It seems that the following construct is valid: template<bool b> class TOTO {}; template<> class TOTO<false> {}; template<> class TOTO<true> ...
[3 replies] Last: Your question was about inheritance from different specialization of t... (by MiiNiPaa)
Unresolved external problem lnk2019
 
Hey guys, I'm struggling with these problems I got a lot of unresolved external errors 1>game.obj : error LNK2019: unresolved external symbol "public: __thi...
[5 replies] Last: http://stackoverflow.com/questions/219381/how-to-exclude-files-from-vi... (by MiiNiPaa)
Quick int for loops
 
Quick question! Is this... for ( int i = 0; i < 10; i++ ) { ...blah blah code... } the same as this... int i; for ( i = 0; i < 10; i++ ...
[8 replies] Last: Thanks very much guys, ill take that into consideration when writing m... (by SuperStinger)
HELP- not saving keystrokes to the specified location
 
Here's my code, my problem is that it is not sending the keystrokes to the LOG.TXT file I want them to be going to. What am I doing wrong? 1 #include ...
[1 reply] : When you find yourself using multiple if else-if statements means it i... (by Smac89)
Compiler? Microsoft Visual Studio C++ 2010 / Code::Blocks
 
Good evening "my time" . I would like to compile my programs for "any OS" Windows/Unix etc. which would be the best IDE, I hear that VS C++ 2010 is windows pr...
[3 replies] Last: Thanks for your quick response, I decided to use Code::Blocks. I like ... (by closed account 4y5Ly60M)
by Neeru
Significance of assigning a number using bitwise operators
 
Hi, can anyone let me know the difference between at performance level, if any, between the following cases, during assignment? case 1: #define Value_16 1...
[2 replies] Last: Only a few nano seconds faster during _compiling_ using case #1 vs. ca... (by chuxnorth)
Choosing input streams
 
So I built an interpreter for a language I made, but I can't get the streams right. I have an istream pointer and if they don't supply a cmd line arg, it refere...
[1 reply] : //std::istream *pointer; pointer = new std::ifstream(filename); if (... (by helios)
by Mats
Finding a specific instance of a class
 
So I have a class that is like this: class card { public: int id; int val; }; card card1; card1.id = 1; card1.val = 2; card card2; card2.id = 2...
[3 replies] Last: Your code fragment and question suggest you are a beginner? In that ca... (by andywestken)
VERY SIMPLE!! Won't run correctly
 
#include <iostream> #include <string> #include <iomanip> using namespace std; //Create a simple C++ program to: // 1. Ask the user for name // 2. ...
[1 reply] : You need to use a string for the username, not an integer. Also, take ... (by Mats)
by begack
Output 2 text files
 
Hey guys, so I'm trying to output 2 different text files, one has customer names and the other has items they are selling. I gave each customer an ID and eac...
[2 replies] Last: So would you read the files the same and then put them into vectors? O... (by begack)
data structure question
 
void weightedGraphType::shortestPath(int vertex) { for (int j = 0; j < gSize; j++) smallestWeight = weights ; bool *weightFound; we...
[3 replies] Last: I mean `Project 7 ch.12 - 3.exe', the executable. And the object files... (by ne555)
by Snaksa
Mobile programming
 
Hi everyone! I'm asking here because maybe you will know the answer of my question. I want to make mobile apps (mostly for Android), but I don't know how. Shoul...
[8 replies] Last: You can use Marmalade (mainly a C++ framework),it supports both IOS an... (by Awareness)
How to add to a vector of vectors
 
In my program i'm trying to have a function that returns a possible set of moves for a knight chess piece to move based off of its current position. Here's what...
[1 reply] : std::vector<std::pair<int, int>>temp; temp.push_back( std::make_pair(... (by vlad from moscow)
by sever
Pointer to method problem
 
Hi guys, Could you please help me to correct this example code ? --- #include <iostream> #include <string> #include <map> class HiddenFunc { publ...
[2 replies] Last: That's it !!!... Thanks ;) (by sever)
Brute-force attack algorithm
 
So basically I want to test all combinations of characters in fixed size string passing them into Hashing function and testing the result with the target hash. ...
[1 reply] : Main idea: bool next(std::string& x) { size_t len = x.size(); ... (by MiiNiPaa)
Creating a custom filetype
 
Hi, I am making a level editor that needs to output a custom map file for use with source code that I will write for a graphics library. My question is: What...
[3 replies] Last: [quote=martianxx]" Also how can I encode a standard bitmap image into ... (by closed account zb0S216C)
May 2013 Pages: 1... 1011121314... 47
  Archived months: [apr2013] [jun2013]

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