Beginners - March 2020 (Page 2)

Array/Loop assistance?
 
1. Declares an array of 5 integers and initializes each position to 0 2. Use a loop to prompt the user to enter the data into each position of the array. 3. U...
[4 replies] Last: Hello Murasame, That will work to a point as long as the user always ... (by Handy Andy)
Operators
 
So i have to write an !operator that changes the symbol ( if its + it shows -, and if its - it shows +) of a complex number of my choice, and i dont really unde...
[6 replies] Last: Why do you need void? The complex conjugate is a complex number; that'... (by lastchance)
ICAO Program with function.. help?
 
The instructions for my assignment are pretty simple design a program that takes user input in the form of a string and transform it into corresponding phrases ...
[2 replies] Last: I was able to fix it by moving the output prompt around a bit. Thank y... (by urbanmystic)
reverse an array(convert from void to int error)
 
I need to write a program which reverse an array using a stack.I have one error which says that can not convert from void to int and I don't know how to approac...
[4 replies] Last: Yes, it's working now.Thank you for your help! (by valiciousx)
Deep copy of pointers
 
Hi, A class called Pair and its member variables int* pa and int* pb have already been created. I am trying to do a deep copy of pointer pa and pb. Please se...
[1 reply] : Use code tags: //Your Code Here You're code looks fine s... (by zapshe)
palindrome
 
Write a program to get the number from the user and print the th number palindrome of even length. input : Is an integer . 1<= n <=1000000 output : A p...
[6 replies] Last: hi again . no you're a genius also as i mentioned your code string(... (by John3682)
balances brackets problem(always the output is good)
 
I have to write a program which balances a string with brackets.I wrote the program but it doesn't matter which string I enter because the program always says t...
[5 replies] Last: I understood.Thank you! (by valiciousx)
asterisk pyramid problem
 
I am having trouble with one of the asterisk problems what I need help with is the output of invalid number if you input a negative number. I feel the solution...
[8 replies] Last: #include <iostream> #include <string> using namespace std; void draw... (by lastchance)
precision and printing out digits
 
For my lab, I am trying to print out the value of sine using a function. The printed value should display 5 digits after the decimal. However, the angle that is...
[1 reply] : cout << "sin("<< i <<") = " << sin(valueOfSine) << endl; ... (by lastchance)
Using switch statement to get same output
 
How would you write out the code using switch statements to get the same output. If you can, please write a comment next to the lines changed to provide a brief...
[4 replies] Last: Thanks for the resources. I'll give it a try (by tetsuuuu)
creating a change in a enum in c++
 
I am creating a game when the player lands on "F", the enumeration in the player class has to change between good and bad. For example, if the player already...
[1 reply] : You already have a Player class, add a member data that encapsulates t... (by George P)
Classes derived from the same base
 
Suppose I have the following code: class animal { public: bool is_male; long double strength; }; class fish : public animal{}; class bear : public animal{...
[4 replies] Last: Thank you for your help! Can you further explain why the class needs t... (by arczi w)
(Easy, i think) array sorting problem
 
Hi everyone, i'm making a raycasting renderign engine, i have to sort by distance the sprites, from further to nearest. First of all i scroll (sorry for my bad...
[5 replies] Last: Thank you all for responding! I didn't know about std::sort(), by the ... (by LakySimi1)
How to NOT skip a line in output
 
Write your question here. #include <iostream> #include <iomanip> using namespace std; int main(void) { double a; double b; co...
[3 replies] Last: Hello tashmanm, To the right of the code box there is a gear icon and... (by Handy Andy)
Character array initialization
 
Hello guys, I'm working with a class that contains an 2-D array of characters (char ). In my constructor, I am taking in a string, with length a*b (dimensions...
[7 replies] Last: Thank you so much for all the help! I really appreciate it. (by tambravan)
how to input string variables with multiple words
 
How do I input string variables that are multiple words. I am using #include <string> using namespace std; Then: string variableName; then: cin ...
[1 reply] : Formatted input: cin >> something; Unformatted input: getline( cin,... (by Duthomhas)
by Utku
SFML adding an object with respect to other ones
 
In my SFML application, I want to add waypoints to the specific coordinates. However, I want to add them with respect to other objects. For example; https...
[3 replies] Last: so instead of a.x = X a.y = Y you want to do a.x = b.x + offset_x a.... (by ne555)
function not compiling
 
It's hard to find a discussion post with super basic errors like this. Can someone tell me what I'm missing? I wrote another function above this function th...
[2 replies] Last: Hello Homedogslice, Actually all you need is or (i = 0; i <= numTerm... (by Handy Andy)
Is element in array: true/false
 
Very basic question: Is there a way to return a TRUE/FALSE if an element is in an array or not? Say I have int myArray = {x, y, z,}; where x-z are integers. ...
[10 replies] Last: All right then Fry... #include <cmath> #include <functional> #inclu... (by Duthomhas)
by knxknx
void function output
 
I have a program to output the phonetic version of a string input, however I cannot seem to get it to output in one line, it currently is outputting one charact...
[1 reply] : There’s a number of issue in your code. Some of them: 1) Declare yo... (by Enoizat)
March 2020 Pages: 1234... 14
  Archived months: [feb2020] [apr2020]

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