Beginners - March 2013 (Page 68)

srand(); C++ question (1,2)
 
Hi, i am using "srand(1);" and "int random = rand() % 5;" in my code. When i change the value in "srand(1)" to different numbers i get different results. ...
[31 replies] Last: ..well you're my hero anyway :p (by Computer Hermit)
Text file input question
 
I have a text file im supposed to use for input. Each line looks like the following: + 23 34 - 16 8 % 50 32 I am supposed to take each line and perform...
[2 replies] Last: that worked. Turns out the loop was doing it for me. Let me try to fin... (by Xilonian)
Composite type
 
I'm reading now ISO/IEC 9899:TC2 draft and confusing about that composite type (6.2.7, in c11 same punt). I cannot get when such construction could be useful. ...
[5 replies] Last: It's about the compiler coming up with a type when faced with conflict... (by Cubbi)
problem with "bytes.h"
 
hi all i have problem with #include "bytes.h" i cant found this in file MSDN //c:\**\**\desktop\s\sss.cpp(5) : fatal error C1083: Cannot open include ...
[2 replies] Last: thanks you , sir :) (by int man)
Multifile Compilations
 
I made 4 files but everytime I compile persontest.cpp, I get this: /tmp/ccn9tigF.o: In function `main': persontest.cpp:(.text+0x3e): undefined referenc...
[2 replies] Last: Thanks! (by UndeadNexus)
trying to create two consectutive #'s where one is either odd and the other even or vice versa
 
SO far what i've done is below and the else statement isn't working. It almost always gives me a 0. #include "stdafx.h" #include<iostream> #include<cti...
[5 replies] Last: I made the changes suggested by the others and it appears to work for ... (by AbstractionAnon)
A kind of math game
 
there are number 1,2,3....2013 on a blackboard,erase any two number a,b of them and input 2(a+b) in it. assume the last number is c, find the biggest value of c...
[2 replies] Last: it should be repeated and therefore there are many possible value of t... (by DANNY123)
Help with generic vectors
 
Hi, Does anybody know how I would create a vector with a generic type? Basically, I need an array (vector) of size 3 that will receive input from the user and ...
[9 replies] Last: Wow, it works! Thanks a lot! I haven't learned structs yet though. I w... (by anderfernandes)
Database searching function
 
Hello everybody, The title says it all, I made a simple database that saves the data in a text file. but I need to add a search function, also, I want to k...
[2 replies] Last: I recommend learning about basic program control flow and design first... (by ResidentBiscuit)
Totally confusing nested loop that uses blank/char patterns
 
Hey, so yeah, usually I have no problem with this if it was a static set variable. But the variable itself is declared in this instance, so that means any numb...
[1 reply] : The hardest part here was to understand the question. If I interpret c... (by Chervil)
looking for simple/basic client server application
 
i have looked at loads of websites but i just can't find code for a simple client server application using a console application (visual studios). I just wan...
[6 replies] Last: i already looked at these tutorials and they didn't help (by beginner123)
wont read last line from file?
 
So i have an almost complete program but it will not read the last line? what do i need to change for this program to work using fin.eof() or the infinite while...
[1 reply] : There's something missing from the code above: [code firstline=40] //... (by Chervil)
Implement all functions in the class
 
I've been trying to implement all the functions in my class, but I keep getting errors. I want to display a profile from user input. Any suggestions? ...
[4 replies] Last: Oh thank you. That did it. (by UndeadNexus)
Object lifetime question
 
Hi, I am wondering, if this is correct, or not, considering the lifetime of the strings in the vector "strings". This is a simplified version of some actual cod...
[1 reply] : When you push_back() , you are making a copy of what you pass into ... (by Stewbond)
How do safely add or subtract a number from an iterator?
 
Hi everyone, Suppose I have an iterator and I want to increment the iterator by, say, 5. Without adding 1 to the iterator and checking it != vec.end() at e...
[5 replies] Last: std::distance works out the distance between 2 iterators - you query... (by TheIdeasMan)
by zenniz
Alternative solution to put different int variable into one int array?
 
Any alternative solution to put for example int variable A, B, C, D into int Array instead of declaring A = Array , B = Array etc... ?
[1 reply] : int Array = {A, B, C, D} (by MiiNiPaa)
Passing arrays
 
So Im quite a novice. I have searched for some of this information but i dont know what im really doing wrong. TBH i am not 100% confident with arrays and point...
[5 replies] Last: i would be helpful if you could post your entire code so i can run it ... (by Yanson)
by zenniz
How to split the character in a variable into half?
 
Anyone know how to write a program for the process stated on the title? I'm trying to hard code some Modbus process for my project. For example Firstly, there...
[6 replies] Last: @SatsumaBenji One again. According to the C++ Standard 9.5 Unions... (by vlad from moscow)
linked list simple
 
Hello everyone I am trying to print the linked list but I keep getting error can someone just point out the mistake? I just cannot see it. #include <iostrea...
[1 reply] : found out just had to add head = ptr; (by rohanshah1)
unresolved external symbol
 
I am having a hard time calling a method from a superclass. I have two classes, levelBase and levelOne, where levelOne inherits from levelBase. I am trying to c...
[2 replies] Last: So, something like this? static sf::Sprite levelBase::getTile(Tile ... (by Wnt2bsleepin)
March 2013 Pages: 1... 6667686970... 87
  Archived months: [feb2013] [apr2013]

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