Beginners - December 2012 (Page 47)

by pen
Problem in pointer
 
int main() { int i=512; char *c=(char *)&i; c =1; printf("%d",i); return 0; } Can anybody clarify me the step by step execution of the above pr...
[4 replies] Last: Oh great! It was really very helpful to me :D (by pen)
by Wurter
Xor two arrays of varying length
 
I need to xor two arrays of varying length. This is what I have so far // EXERCISE 7# unsigned char a = {0x11, 0x22, 0x33, 0x44}; unsigned char b...
[1 reply] : What do you plan on comparing b and b to? You can't compare it to t... (by Stewbond)
Creating a Loop
 
I'm looking to create a loop that will have the play retype a variable if they type in the wrong one. this is the current line om working on cout << "\...
[2 replies] Last: Say I want it to always display the error message if they player does ... (by Leofas725)
Function showing BMP doesn't work
 
Hi, I'm from Poland so sorry for my bad English. I was created a function showing a BMP image. But it doesn't work when i try to compilate this (I'm using...
[no replies]
Default template
 
We can set a default type for a template class like so: template <class T = double> class someClass { T m_member; }; The above compiles only if I declare...
[no replies]
Simple Calculator NOT WORKING!!!
 
Basically, the calculator i programmed does not work. I did some forward declarations of the functions that I was going to use in the program but when it did ...
[14 replies] Last: If there's any clash of names in the std namespace, its a good reason ... (by Chervil)
by ab123
Copy or reference?
 
I have a function like this in class Report: inline const Info& GetInfo() const { return *info;} info is declared in the same Report class as: Info* in...
[2 replies] Last: new_info will be a copy of the Info object in my_report. Using the set... (by Peter87)
How do I get the compiler to tell me my errors?
 
So I wrote this Binary Search Tree, and it's full of errors. I'm trying to fix these errors so I can get it to compile and make it actually work. However, I'm n...
[1 reply] : ok, so the error I listed was caused by a mis-matched {, I fixed it, s... (by mistabob)
War Card Game - Shuffling a deck
 
I'm working on a C++ project using Visual Studio 2010 and I'm trying to program the card game War. I figured the steps would be 1) Declaring 52 cards (Done) ...
[13 replies] Last: Nice!!! So have written some similar code to this, but I am trying to ... (by socceraddict)
c++ help
 
every time i try to run my program i keep getting an identification error for empInfo. i tried putting int empInfo; but it wont work can someone please help me ...
[2 replies] Last: empinfo is the name of an array, defined in function main(). emp... (by Chervil)
file input problem
 
So I found a way to just input my file and just see what happens if I just read it in and print it back out using this: #include <fstream> #include <iostream>...
[no replies]
Forward slashes? Writing an operation
 
The Problem. A for loop header that uses a counter variable has the form for (int i = 0; i < n; i++) Declare a counter variable i and rewrite the for loop head...
[2 replies] Last: thats what i was thinking, i just didnt know why they didnt just use 2... (by jeckel7234)
xml parsing
 
I am looking for a good overview of c++ xml parsing practices. I am using tiny xml parser and the algorithm that I have developed to extract information is quit...
[no replies]
Processing Data From a File
 
For this problem I am supposed to write a program that will not only invoke a file but also process the data within the file. The problem I am having is I don't...
[2 replies] Last: "invoke" is meaningless in this context. Valid file operations include... (by Chervil)
reversing a linked list (nodes) random crash
 
I'm trying to write a function to print out the values of a linked list's nodes in reverse, it works perfectly fine, but causes my program to crash once it fini...
[2 replies] Last: it still crashes if I use while (cur-> next!= NULL) (by nickcplusplus)
is (false < true) ?
 
I'm writing a class to check for differences in discretes (bool), but I want it to be applicable for other types as well. This prints in my compiler (VS2008),...
[4 replies] Last: Thanks guys! That's exactley what I wanted to know. I had thought ... (by Stewbond)
Frequency of characters in array
 
Hello, I'm reading a text file and I'm trying to count the frequency of each letter. Assuming the whole document is uppercase, this is what I have so far. In th...
[19 replies] Last: Dude I don't know what to tell you. I just copy and pasted my code tha... (by jlillie89)
program outputs word vertically
 
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <ctime> using namespace std; int main() { vector<string> wo...
[2 replies] Last: Yes, sorry for the late reply. I forgot about this post, and why? (by DJLad16)
IntelliSense Errors
 
Ok, so in short, Im doing A level computing, and for my coursework I'm writing Battleships. So far all's been going well, but recently, I have added a 'Valid...
[4 replies] Last: Thank you very much! will let you know how I get on :) edit: I have f... (by Kabooss)
Struct member manipulation
 
The following Ada95 code snipit allows me to define how the compiler handles the fields of my record. Will C++ allow me to accomplish this same task and if s...
[2 replies] Last: I found what I was looking for...bit field packing thank you (by tsnofvdr)
December 2012 Pages: 1... 4546474849... 65
  Archived months: [nov2012] [jan2013]

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