Beginners - September 2017 (Page 8)

Understanding bit shifting
 
https://www.youtube.com/watch?v=KjHKwCZyAhQ So I am trying to get the same output this youtuber gets but I am stuck on part of his code. Namely, the bit shifti...
[2 replies] Last: >>8 shifts 8 bits, which is 1 byte. So a 2-byte integer 0xabcd become... (by jonnin)
LiveEdu launches Soft Indiegogo Campaign
 
Just so you and a few selected users know. We have just made a soft Indiegogo campaign launch before the public launch. You can get up to - 30% Early Bird disco...
[no replies]
Vector<Enemies> moving enemies
 
I have an Enemy class. I am loading the enemies into a vector. The enemies all do the same thing. Move to the same place. How would I implement they move fro...
[5 replies] Last: std::this_thread::sleep_for is one option. http://www.cplusplus.com/r... (by Thomas1965)
Having problems with a simple encryption program
 
Hello, I'm having a lot of trouble programming an encryption program. It has to have a menu that loops and allows the user to do five things. Encrypt an entire...
[10 replies] Last: Using that method is a good tip for your future debugging career. . ... (by MarbleHornets)
by samcro
For loop to calculate an amount for a certain month period
 
According to the instructions,the user can enter a number of months and proceed to calculate the below. It should show up to the user as Month 1: *amount* ...
[1 reply] : You’ve been asked to create a loop which modify an integer value: - ... (by Enoizat)
Help with string replace lab
 
Hello all, I am trying to write a code that takes a user input, makes it into a string and replace the that string with other input. I have tried substring and...
[4 replies] Last: Works even better with #include <iostream> (by closed account 48T7M4Gy)
Program compiles, but won't give correct output
 
I'm taking my first C++ class at school. and our first project is to write a program that can convert a whole number between 1 and 8 to binary. I wrote a code t...
[6 replies] Last: Correct. You clearly should not compute remainder from the Second, sh... (by keskiverto)
error: ‘class Rec’ has no member named ‘mycity’
 
I want to print *(*it)->mycity , but it said has no member named ‘mycity’? #include<iostream> #include<vector> using std::vector; using st...
[1 reply] : What don't you understand about the error message? You haven't defined... (by jlb)
by samcro
Flipping a boolean value upon user entry
 
Hi all, I would like to know the best way to flip a boolean value to true from false. It is regarding an assignment I have for an introductory c plus plus cours...
[4 replies] Last: Got it! Thank you so much Jonnin! You are a life saver :) (by samcro)
deep copy logic c++
 
I just want to make sure if I understand the idea behind deep copy correctly, just a first year CS student. For example, if object A = {1, 2, 3}, and we creat...
[4 replies] Last: Ok, so there are some terminology issues here. An object has member va... (by Duthomhas)
copying objects c++
 
Here is a code: // stack is a class // st1 is an object that contains something // st2 is a newly created object stack st1; // ... stac...
[3 replies] Last: @coder777, thanks for your help. -----------------------------------... (by Kourosh23)
by p4nd4
Initializing Variables
 
Hey i'm currently taking a c++ class and had to do a homework assignment where i calculate the miles per gallon with the given miles and gallons used. After I s...
[1 reply] : https://en.wikipedia.org/wiki/Initialization_(programming) (by mbozzi)
Can a base class access variables in its derived class?
 
Hello guys, I'm fairly new to c++, and just started learning inheritance. I came up with a quick question here. In the code I created below, can the base class ...
[5 replies] Last: @gunnerfunner Thanks for the advice :)) I did compile my program befor... (by benjylol003)
by beemo
Not user friendly?? idk why
 
Hey guys, so my program compiles and runs, but for some reason when the user inputs an employees name with a whitespace(for example "Egg Chunk" instead of just ...
[3 replies] Last: ^^thanks! it worked:) (by beemo)
by cibide
Can't find error on return-by-constant-reference
 
Can Someone explain why the first one is correct and the second one is wrong? const string &findMax(string *a, int n) { int maxIndex = 0; for (int i=1;...
[2 replies] Last: thank you! :) (by cibide)
by beemo
?? already submitted my answer but im confused
 
// Write a program that copies the data in the // prelab input file to an output file "flux_capacitor" // so that it is formatted the same in both files. ...
[2 replies] Last: thanks! (by beemo)
Extrapolating line and moving object - SFML
 
I am using SFML. I have a rock object. It moves from its starting position, always the same to the players position which may be different. I have taken the dif...
[3 replies] Last: if you are just moving at a fixed rate in 2-d, just add to the current... (by jonnin)
Store if-else statement
 
if (status == 0) { double a = 6000, b = 27950; if (income <= a) tax = income * 0.10; else if (income <= b) tax = a * 0.10 + (income - a) * 0....
[3 replies] Last: two concepts that might help you: a "state" variable, like an enum, ca... (by jonnin)
Fibonacci sequence
 
Im trying to make this program write out only the last number in the fibonacci sequence right now i always get the whole sequence any ideas?? #include <i...
[2 replies] Last: Thx it worked! (by Jaggy1997)
stringstream into 4 variables without comma
 
I am struggling to figure out why the first data item is not appearing #include <algorithm> #include <string> #include <iostream> #include <sstream>...
[2 replies] Last: #include <string> #include <iostream> #include <sstream> int main() ... (by Chervil)
September 2017 Pages: 1... 678910... 21
  Archived months: [aug2017] [oct2017]

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