Beginners - July 2016 (Page 21)

by elay
how to properly intialize static const user defined types
 
how to properly intialize static const user defined types? class MyClass { public: static const sf::Vector2f defaultPos = sf::Vector2f(WINDOW_HEI...
[2 replies] Last: Looks like it's not a constant expression, because of the function cal... (by TheIdeasMan)
Pointers and chars
 
hey guys, I'm working my way through c++ primer and using sources such as this to help me. I read that each memory cell is 1 byte big (8 bits). So when I declar...
[2 replies] Last: Haha thank you dude you helped a lot:D (by Pixelninja48)
How to display ASCII characters from ! to ~
 
Write a program that displays the characters in the ASCII character table from ! to ~. Display ten characters per line. The characters are separated by exactl...
[5 replies] Last: What I mean is that each line ends with a space, and then a newline. ... (by dhayden)
by Lodi
Libgomp.spec missing
 
Hi, tried using openMP using a g++ compiler on the command prompt of a Windows 7 computer. This is my compilation line: C:\Users\Ian\Desktop\Phd\programs>g++...
[2 replies] Last: Thank you Duoas, it worked. Lodi (by Lodi)
Easy Color Use
 
Hey guys, I wanted to ask a design question, but I'm still a massive noob so... The long and short of it is I want to use colors for the first time (noob) in...
[4 replies] Last: SetConsoleTextAttribute() is a very lightweight function. Call it as o... (by Duthomhas)
Need some help with c++ functions (a lot of functions with combination)
 
hi, guys i'm in colleage trying to do some homework with cs10 and got stuck with this combination of functions please help me out!!!! T^T spent 8hours today sti...
[3 replies] Last: http://www.cplusplus.com/forum/general/194120/#msg933544 (by Naughty Albatross)
by FBHSIE
Logic error (letting me put >50)
 
Write your question here. It shouldn't be letting me put more than 40, but it is. I'm not sure what's causing it? //Ashton Dreiling //Payroll program ex...
[4 replies] Last: if (status==true) This can be written: if (status) { } The fal... (by TheIdeasMan)
Dynamic memory allocation inside an object
 
Is there any problem if I create a dynamic array on the heap when calling this specific member function (initial(..) of the Combosorting class ) ? Why it just...
[14 replies] Last: The mind boggles at your interpretation. There is no mystery. There is... (by closed account 48T7M4Gy)
c++ madlibs
 
I have a project due at midnight and im stuck. My program isn't compiling properly. Please help. //CS 161 //Project 1 //Sources: None #include <iostrea...
[2 replies] Last: Hi, string Story ; this means Story ; string Story ; string Story ; ... (by shadder)
Help with finding sum and average of numbers in a file?
 
Hello! I got the first part of this (opening the file and getting the total amount of numbers in the file). However, I am stuck on how to now get the sum of the...
[5 replies] Last: Just to let know your logic errors : double total; // Where's the... (by Naughty Albatross)
Having User Open a File and Word-Counter of Those Files
 
I'm literally losing my mental sanity. I have been attempting this problem for 3 days now, and can't attempt anymore. I cannot figure out what I am doing or eve...
[8 replies] Last: That is impossible. Did your program finish executing without you pres... (by Naughty Albatross)
Weirderror
 
when I compile my code i get this weird error. bash: line 12: 7202 Segmentation fault $file.o $args And this error is different to any of c++ error I ha...
[1 reply] : In general terms this error often occurs when you're reading data out ... (by closed account 48T7M4Gy)
Calendar Assignment - Where Do I Start?
 
Write a program that prints a calendar for one year, given the day of the week that January 1 falls on. Each successive month starts on the day of the week that...
[1 reply] : Where do you start? Best place is at the point where you realise this... (by closed account 48T7M4Gy)
Random number generator with rolling a dice
 
I have to general random number with rolling a dice (6 sides) for 4 players. while (maxScore<100) { for (p=0; p<player_num; p++) { dieVal=ra...
[7 replies] Last: You didn't initialize your number array from the start. Put it before... (by Naughty Albatross)
logic of boolean
 
I wrote a function that checks for duplicate numbers within an array. Could someone please explain how the logic of true/false actually works? What would be ...
[1 reply] : Hi, bool is essentially true/false or 0/1, just think of it as a flag... (by shadder)
Function not returning average
 
I cannot find reason why function is not returning average correctly? #include <iostream> using namespace std; double calcAvgScore(int score1, int s...
[7 replies] Last: http://www.cplusplus.com/forum/beginner/194077/2/ Multiple posting of... (by closed account 48T7M4Gy)
insertion sort code
 
Hi people I just asked a question on finding the smallest number and index I have figured that out with credit to all the people who helped me on here but now I...
[9 replies] Last: I figured out why I was getting that output changed 0 to i on line 34 (by adam2016)
How to compare 2 std::strings in an if statement
 
I'm trying to compare 2 std::string variables in order to determine if my program is running on a Raspbian Linux distro. The function runs a bash script that ...
[5 replies] Last: Actually, dhayden was on the spot with his answer, it does have to do ... (by hashbrown)
by Ch1156
Is this code efficient?
 
I wrote this program to test my knowledge of classes, and I think I finally got the hang of them. I want to move on to inheritance next but I would like to know...
[7 replies] Last: NameGenerator.h assumes that you have already included fstream and ios... (by dhayden)
by FBHSIE
Questions about code and random function.
 
I just had some random questions about C++ coding I've been thinking about. For the variable won, if it isn't set to 0, a logic error occurs when total is p...
[5 replies] Last: I mean if none of slot1, slot2 and slot3 are the same then the last e... (by Peter87)
July 2016 Pages: 1... 1920212223... 30
  Archived months: [jun2016] [aug2016]

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