Beginners - December 2012 (Page 24)

string's null character
 
do i need to add *t='\0'; after line 10....or is it copied from str1 itself?? #include <stdio.h> int main() { char str1 ="hello"; char str...
[6 replies] Last: I think you meant while ( *t++ = *s++ ) as JLBorges showed. At first ... (by vlad from moscow)
If and Else If help
 
Hello, When the input is between 100 to 200 I want the output to be "steal", when the input is 1 or 0 I want the output to be "steal". And when the input is ...
[3 replies] Last: Well, you have two options here. You can learn about file streams, whi... (by Volatile Pulse)
Advice on how to get started on this project?!?!
 
I'm going to write a program that will prompt the user for the colors on a 4 band resistor and then calculate and cout the resistance and tolerance of that resi...
[2 replies] Last: From my experiences so far on this forum, I've noticed that engineers ... (by Volatile Pulse)
Function only returns the first elelement of the array
 
So I'm trying to print out an array that I'm returning from a function. Right now only the first element in the array comes back correctly, the rest of them co...
[5 replies] Last: This'll probably help you a little: http://www.cplusplus.com/doc/tutor... (by snow 56767)
2D Gaming Libraries
 
After a bit of Googling, I haven't been sure of what library I'd like to use. I'm going to attempt to create a 2D game, and was wondering if I could get opinion...
[2 replies] Last: SFML is a good one. I would recommend writing your little game that co... (by snow 56767)
problem with string
 
i am not able to catch the difference between the following two piece of code char name ="john"; printf("%s",name); and char name ="john"; printf("%...
[1 reply] : well...it is a matter of pointers. When using the & operator, you ar... (by snow 56767)
traffic light pseudo code how to implement it in c++
 
Hello Everyone, i hope everyone is fine , i wrote a pseudo code in how the traffic light works where there is one intersection with one way traffic each side ,t...
[2 replies] Last: sorry for that .. but what i meant that i want an idea to represent th... (by coffebean)
doSomething???
 
what is/what does it do i've seen people put it in suggested code for other questions of mine but is there an actual command for this? example } voi...
[2 replies] Last: thats how I "was"/still am taking it, I'm just taking a quiz online an... (by jeckel7234)
how to pass a matrix to a function?
 
I'm working on a 6x6 checkers program for AI class, I'm trying to pass the states as matrices, for example, starting state is the matrices int matrix = ...
[2 replies] Last: And it would be easier to use nested for loops to do the printing. HT... (by TheIdeasMan)
c string arrays and classes
 
Hello. First time post here. I'm having trouble working with c strings (not c++ class objects) and classes. Here is my code: #include <iostream> #incl...
[3 replies] Last: Thank you very much for your timely, and very helpful response. Fixed ... (by Brentj0hns0n)
How can I fix this class or possibly make it easier on myself?
 
I am trying to make a function in a class. I am having troubles with it because it is giving me the error, "no matching function for call to 'CMonster::CMonste...
[2 replies] Last: Any time you define a constructor for a class you have to include an e... (by Raezzor)
[C++]Using the pythagorean theorem for collision detection
 
I am recreating Pacman in my class, and I encountered a problem making the ghosts collide with Pacman using corner collisions, so I was told to make a function ...
[17 replies] Last: Oh my god, I just realized I set center.y to TopLeft.x... Everything i... (by Enchant)
OutFile to file help
 
I'm trying to outFile to houseData.txt. I did that fine but now all the data is all on the same line 10 times. What did do wrong in my code? House Price Num...
[1 reply] : I think you just have to format it. You know how when you don't send ... (by jlillie89)
Best option for a list of variables
 
Not sure if I know how to explain this efficiently but basically I want to make a "list" of 50 objects(?), each with it's own string and two double variables, s...
[9 replies] Last: @Marcos Modenesi lottery Al = { "Alabama" , "AL" , .07 , 10000000};... (by TheIdeasMan)
How to translate a Makefile from Windows to Linux
 
Hi everybody, I am a Linux user. I needed something to convert Derive into LaTeX code I found on the web an old program with sources compiled for windows, usi...
[no replies]
std::cin input being skipped?
 
Some input is being skipped and it sets the variable to null or empty or something. Here is the relevant code short int bindedPort; //prompt for the por...
[6 replies] Last: The '\n' newline character is still in the buffer from the first cin s... (by Chervil)
Functions
 
How can I make a function which perform an arithmetic operation then performs a statement based on the type of number that is made. e.g. (decimal, integer) e...
[2 replies] Last: Yes that was what I wanted! Thank you! (by closed account LN7oGNh0)
help
 
Hi guys. Can u please help a beginner to understand, what is the difference between putchar and printf ? And what is fgets ? Ive seen people use fgets for s...
[1 reply] : Included from <cstdio>: fgets (http://cplusplus.com/reference/cstdio... (by Volatile Pulse)
by ft95
binary to decimal with function
 
hello,what is the problem in this program? #include "stdafx.h" #include<iostream> #include<cmath> using namespace std; void BinarytoDecimal(); int c...
[13 replies] Last: You need to specify since there are two styles of strings. You still n... (by Volatile Pulse)
char length :|
 
Hello guys :) My question is how can I verify the lenght of a simple char.Rather i wont to know if the char is empty(that means,that the user pressed ENTER),or...
[2 replies] Last: A single character cannot have a length. You must use a character arra... (by S G H)
December 2012 Pages: 1... 2223242526... 65
  Archived months: [nov2012] [jan2013]

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