Beginners - June 2013 (Page 39)

Returning Strings?
 
Hi, Writing a very basic function that checks a password is correct, no checks for username of anything. Program works I just cant get the return message "Ac...
[6 replies] Last: Cheers, glad I could help. :) (by Thumper)
by Blank
Conditional expressions
 
i just wanted to double check if the code i wrote is right.i have to turn these conditional expression into if/else statements. total += count == 1 ? sales...
[3 replies] Last: @Chervil Should be parentheses around the condition There is no ... (by vlad from moscow)
by Blank
conditional statement
 
how do i turn this into if/else statement cout << (((num % 2) == 0) ? "Even\n" : "Odd\n");
[1 reply] : if ( num % 2 == 0 ) cout << "Even\n"; else cout << "Odd\n"; (by vlad from moscow)
Is using too much srand(time(0)); bad?
 
In my code I used srand(time(0)); more than once. In each of my functions I had it. So is that bad? or if i use it once will it for ever randomly generate nu...
[4 replies] Last: alright thank you all for this helpful information! (by sakonpure6)
by Blank
conditional expressions
 
how would i write this in an conditional expression? .if (temp > 45) population = base * 10; else population = base * 2;
[2 replies] Last: thank you :) (by Blank)
expected primary-expression before ‘unsigned’
 
Greetings, I'm new to C++ programming and have been studying it for a couple of days. I have run into a few problems, like all beginners, but have always been a...
[6 replies] Last: you declare lista like lista lst; lst.something(); You were trying... (by giblit)
being forced to use only one variable in function which needs two variables
 
Here's the error I get in Visual C++: 1>------ Build started: Project: testing stuff, Configuration: Debug Win32 ------ 1> testing stuff.cpp 1>c:\users\hp\d...
[2 replies] Last: There are a few problems here. For example, line 68, this is a functio... (by Chervil)
*= Operator
 
This might be a stupid question, but what does *= operator do? I have these two statements in the code: double NoverL = N/L; NoverL *= 1.0-Mratio(2)-M...
[3 replies] Last: It's a compact way of modifying the variable on the left of the operat... (by Chervil)
by loai27
-1 IND
 
I am getting -1 IND for my output. I can't figure out what I did wrong. I am trying to calculate the batting average of a baseball player. //main #include <...
[4 replies] Last: I'm saying you're not using the parameters fed to the function. And ... (by cire)
Assertion Error
 
I keep getting an assertion failure with the following code. FieldBuilder field ("alexandria_city.dat", 40); //creating the object //Constructor Field...
[2 replies] Last: That solved the issue. I'm just starting to learn C++ so I don't reall... (by olibiakos)
Deleteing dynamic arrays
 
Hello every one I have a question that I am sure you have seen a million times but I am not wanting code. I am writing a dynamic array class for an assignment. ...
[3 replies] Last: You're welcome :) (by MikeyBoy)
Pointer data types
 
Why does pointer's declaraction needs an identified data types? If its ok (what I'm currently thinking) if not? I have a feeling that it has many reasons but my...
[2 replies] Last: Also, without a type how would it know how much data to read when dere... (by dreyan)
When to use dynamic array or a vector??
 
I am writing a program that deals with statistical math and passes a lot of number back and forth between functions. There are a lot of arrays that are being ha...
[10 replies] Last: http://www.cplusplus.com/forum/beginner/103937/ (by BToven)
Segmentation fault
 
I get a Segmentation fault when i try to fill this vector up this is literally my first go at using them so I cant figure out what I did wrong #include...
[1 reply] : By default vector is empty and hold 0 values. Either do .resize() or .... (by MiiNiPaa)
Equal Numbers
 
Hi, can any one help me making a code for detecting equal and unequal numbers entered
[1 reply] : http://www.cplusplus.com/doc/tutorial/operators/ Have you written any... (by Pebble)
by piczim
Need to understand
 
I have been working through a C++ course and am making slow progress. I enrolled for a course and to my surprise found it to be Active C which is for apple Mac....
[12 replies] Last: I would like to really thank you for your help. Best wishes Rodney (by piczim)
beginner-level problem... I think...
 
This has worked in the past... //eliminate the child from the list map<string, int> newpar = parents; string chil = child; for(map<string, int>::i...
[5 replies] Last: Yes, but the the rest take it's place. No, they don't. You need to... (by firedraco)
Developing a basic game but I can't generate "traps" properly
 
So I am writing a somewhat basic game as a project for my C++ class. I know you guys don't like homework but this idea was entirely my own and I've been workin...
[7 replies] Last: Just a curious question, how did you learn all that? :o That must have... (by GoranGaming)
generate 20 distinguish random numbers
 
I want to generate random numbers from 1 to 20. how can i do it? I did something like this . #include <stdio.h> #include <stdlib.h> /* function main...
[5 replies] Last: use can use shuffle algorithm to randomly rearrange the numbers 1 to 2... (by abhishekm71)
C++ Draw Diamond
 
why always my codes are complicated? This code is to draw a diamond using C++ the code is working fine, but I need tips to make more simple codes #inc...
[4 replies] Last: Wow, I kept tracking this topic from the second I posted this problem ... (by a967Bytes)
June 2013 Pages: 1... 3738394041... 49
  Archived months: [may2013] [jul2013]

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