Beginners - April 2018 (Page 24)

i have got this assigment , i have 80%.
 
how to add object into another object , how can we do it.
[1 reply] : gonna need a little more here... (by icy1)
classes
 
#include<iostream> class A { public : int*x; }; class B { public: A _a; }; int main() { B b1; b1._a.x = new int(1); B b2(b1); *b...
[3 replies] Last: so when using operator () its the same as using = I’m afraid that... (by Enoizat)
Single = in if condition
 
What happens if we use a single "=" in an if condition?
[7 replies] Last: That's good to know. Thanks! (by dhayden)
Print in a Box
 
I'm having some trouble understanding how I'm supposed to go about coding this specific program to take user input and print the sequence centered in a box made...
[3 replies] Last: Which part don't you understand? There are many, many ways of doing t... (by lastchance)
2D Array printing gives "stack smashing detected"
 
I'm getting an error in that says: " stack smashing detected: ./a.out terminated Segmentation fault (core dumped) " after the 2D Array prints in the boardInt...
[12 replies] Last: How did you get the stack smashing error? Compile with -fstack-prot... (by mbozzi)
Using functions From another class
 
Hello, I'm wondering if I can access a function from a class Foo and use it in a function in class bar. Is this possible and if so, how can I pass the argument....
[4 replies] Last: Ok, cool, Thanks for the help (by closed account NCRLwA7f)
Invalid operands to binary expression ('ifstream' (aka 'basic_ifstream<char>') and 'char (*)[26]'
 
heres my 1st part of programme #include <iostream> #include <fstream> using namespace std; void getKey (char m , int size, char* filename); void encrypt (cha...
[4 replies] Last: @tpb thankssss it really helps !!! (by Newbieess)
Super long program, how to optimize?
 
Hey so I'm doing an assignment (https://imgur.com/a/qykyQ) and I'm done with everything except the sort-by-name part and the search function, but it's already ...
[5 replies] Last: References can save typing and eye strain with zero cost: void vIniti... (by dhayden)
A function that counts the different words in two strings
 
Hello! I'm trying to make a function that uses a counter and checks each word (characters in between two spaces) if it is similar to the other string. if they a...
[2 replies] Last: Actually that can get kinda complicated, depending how rigorously you ... (by Ganado)
What is wrong with my code?
 
Below is my code, and I can't get it to compile. It keeps giving me an error on the line that says " if (num % 2 == 0) { ". The error message says "% illegal, l...
[5 replies] Last: I used your help to figure it out. Thank you very much (by ChrisK312)
Initializing a 2d object array with its array position
 
I'm creating a sort of cellular automaton and I'm looking for a convenient way to initialise a 2d array of objects with their positions. I have a cell which ...
[3 replies] Last: Not sure if you can avoid explicitly writing out the loops. It's l... (by NotToday)
Prime Number Print
 
My prompt for this specific code is as follows, "Prime numbers. Write a program that prompts the user for an integer and then prints out all prime numbers up to...
[2 replies] Last: from the project euler website by chance? This is a good read and nic... (by icy1)
Question On arrays in functions
 
Hello, working with some functions today, I ran into a few problems and found out that I don't really understand a few things with arrays or dynamic arrays for ...
[1 reply] : Woo and Foo are two ways of saying exactly the same thing. Even if you... (by tpb)
by cidex
Find number at certain position
 
Hello I have to make a bingo lottery game. So I have two text files with 25 numbers that are random from 1-75 and I push back them into a vector. Two text file...
[3 replies] Last: cidex, you can just make more structures to better arrange certain str... (by icy1)
Pesky ol' Vectors
 
Program has to put evens into one vector, odds in the other, and output them. I currently have this // Vector Worksheet 2.cpp : Defines the entry point for t...
[17 replies] Last: Well then it's not an extendable solution, and I go back to saying % i... (by Ganado)
Basic File Input/Output Test
 
Hi! I am trying to test basic file input and output functions. I was trying to write a very simple code to output numbers entered by the user to a file, then...
[5 replies] Last: Oh wait, you aren't specifying a path for your program. If its runni... (by zaphraud)
by Vendal
Program runs, but not as intended. (functions)
 
Working on another school assignment! This one involves replacing blocks of code with functions that perform the same task. I created the function asking for us...
[7 replies] Last: From your function, playerCorrect . char guess; ... (by Repeater)
A few questions about headers
 
Hello! These questions have probably been answered a thousand times, but I really can't find a clear answer on the internet. Is the general rule of headers ...
[3 replies] Last: Hello daverave1212, Expanding on what dhayden has said you may find t... (by Handy Andy)
Implementing a messaging system using one queue and 3 classe
 
Hi. I have an assignment that asks me to make a messaging system. These are the instructions. Messages are received in the order they are sent The classes in...
[14 replies] Last: Yes, you're right. It doesn't need to be derived from one. I'll remove... (by ofeliedeceai)
by vladdy
payroll program question
 
Hello, I am trying to get my loop working but it's not printing anything out after fica withholdings. Description on program : Write a program that displays...
[2 replies] Last: Hello vladdy, After testing the program I found it useful to add the ... (by Handy Andy)
April 2018 Pages: 1... 22232425
  Archived months: [mar2018] [may2018]

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