Beginners - March 2018 (Page 17)

Returning a 2d array of constant values.
 
Hi! How can I return a 2d array of constant values from a function? I need to return something like this: //I don't even know if this is the best way to do 2d...
[5 replies] Last: @ robgeek : Your attempt had two issues: 1. Compare lines 5 and 12. F... (by keskiverto)
by Gore7
variables in a pointer to a function( hurry up and respond somebody)
 
Write your question here. Ok, this is not literally a problem just a very important c++ aspect regarding values in a function that is used with a pointer. I...
[3 replies] Last: I suspect this was asked in the middle of a test, to boot. (by helios)
Help with operator error.
 
I am getting an error for the operator in my constructor. binary '=' : no operator defined which takes a left-hand operand of type 'type' (or there is no acc...
[2 replies] Last: Please don't start multiple threads for the same problem. It wastes p... (by MikeyBoy)
String formatting program
 
Hello, I am having trouble with a program that is supposed to determine Whether the user entered an item number in the required format: three digits, a hyphen, ...
[2 replies] Last: Okay, thanks for catching that. (by joemcmahon)
Selecting a Vector row for average
 
I'm trying to create a two-dimensional array that contains 25 random generated numbers and calculates the average and total of 5 integers in each row. I was ab...
[6 replies] Last: I attempted to utilize each example but I ran into a lot of problems.... (by keskiverto)
by liegex
Class program to sort student name alphabetically crashes on run.
 
This program is to allow user to input student's name, age and marks. A in the class would then sort the student's names alphabetically. However, this program c...
[7 replies] Last: Thank you all for your help! (by liegex)
by pizza
Post incrementer for my own string class using doubly linked list
 
Hi, I am trying to implement post incrementer for my own string class using doubly linked list. I had no problem with pre-incrementer but somehow, I can't get p...
[3 replies] Last: It is actually hard to tell without chance to test. But my guess is t... (by coder777)
by Catma
How to manipulate switch function to shorten my code
 
Each Case the only thing different is 1 word how do I shorten my code so it is not so copy paste? void sortBy(Documents *parr, int entry, int &count ) ...
[3 replies] Last: Put the switch within the predicate that does the comparison. if (par... (by lastchance)
Shuffling DeckOfCards
 
So, I am considering my deck and the shuffling for the game "Thirty-One" Currently, I have an array . But now I am rethinking that, I am debating if I want t...
[2 replies] Last: I like that ... it just makes more sense ( now that I think about it).... (by rhamm5798)
Sentinel loop ques
 
Hey guys! I recently started programming as a course in college and I am a beginner in programming.I have got an assignment question where I am suppose to writ...
[6 replies] Last: Yess!! Thanks a ton :) (by sairaashraf17)
by rafi21
c-string explanation
 
Write your question here. [#include<iostream> using namespace std; int main() { char name = {'A', 'm', 'y', '\0'}; // a C-string char name2 =...
[2 replies] Last: The name2 is an array of three bytes somewhere in (stack) memory. Ther... (by keskiverto)
How to find the length of a string without .length()?
 
string x = "hello" How would I be able to find the length of this string w/o using x.length()?
[1 reply] : x.size() or x.end() - x.begin() or x.rend() - x.rbegin() ... (by JLBorges)
Program not reading file
 
It has been a while since I looked at c++ so my memory is seriously lacking. I'm probably making a really stupid mistake. I had this working in a single file bu...
[7 replies] Last: Thanks Andy. (by shawnap)
output formatting
 
I am currently writing a coffee shop program, and I want my output for monetary values to be lined up and always in the same spot, even if the characters prior ...
[5 replies] Last: void exitProtocol (int & totalSmallCups, int & totalLargeCups, int& t... (by link45jeff)
String Objects in C++
 
What are string objects in C++? Examples?
[1 reply] : To give you an idea, https://www.tutorialspoint.com/cplusplus/cpp_str... (by chicofeo)
Printing more than once
 
Why does motto3 print twice (line 91)? See output. Constructor called. Constructor called. Constructor called. Executing: motto3 = motto1 + motto2 Add ...
[5 replies] Last: Ah yes! Thank you, kbw. (by phztfte1)
question about function
 
i need help im trying to generate 6 numbers example like 456789,124567 i wonder if anyone could give me any advice. im using a hash std::size_t customer::h...
[2 replies] Last: #ifndef __CUSTOMER_H__ #define __CUSTOMER_H__ #include #include ... (by ghost1111)
Comparing cstrings between arrays
 
This is a spell checking program and I'm trying to compare the two arrays that stores the words read from the dictionary and passage texts but I'm having troubl...
[1 reply] : https://www.tutorialspoint.com/c_standard_library/c_function_strcmp.ht... (by kbw)
understanding the output of g() function
 
I was doing some end of chapter question and had a problem with the following code. Could anyone help me understand the output [ g() ] of the the following snip...
[4 replies] Last: Some things to note: { } blocks are used to create an inner scope. Th... (by Ganado)
by RNBW
C equivalent of BASIC's STRING$(80,"char")
 
I am looking for the equivalent in C of BASIC's STRING$(80,"char") ie printing out a string of 80 same characters aaaaaaaa...etc I found the following code in ...
[8 replies] Last: @Repeater I can't see why you need to use malloc just to print the sa... (by RNBW)
March 2018 Pages: 1... 1516171819... 29
  Archived months: [feb2018] [apr2018]

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