Beginners - July 2019 (Page 5)

Dynamic String Array not Compiling
 
Hi, I'm not understanding why my dynamic array won't compile. int square = 1; int k; for (int i = length; i < length*length; i++){ for...
[4 replies] Last: >> dutch I got it! char** a = new char* ; for(int i = 0; i... (by jjordan33)
Swapping number question help
 
So my question asks me the following: Declare and define a function that swaps two integer numbers: void swap(int &n1, int &n2) Declare and define an overloa...
[5 replies] Last: No, you can't have several variables with the same name. double n1 wo... (by zapshe)
How to have a unique pointer with 32 byte aligned?
 
I want to change my current version to a new version using make_unique function. Reason: I found make_unique much better than std::unique_ptr's constructor. Al...
[3 replies] Last: We thought make_unique could do the work (?) Can it? Mostly. When I... (by mbozzi)
Need Approach with better time complexity? (1,2)
 
Given 2 sorted arrays A and B, if we have to select A and B such that i <= j, find the Kth minimum value of (A + B ). Can anybody tell the approach better t...
[30 replies] Last: my approach in, I think, O(n lg^3 n) (pseudocode) array a, b sorted_s... (by ne555)
Choosing random numbers
 
Hi all, I'm new here, also new to C++. I would like to ask. I got a task to choose two random numbers for each row. After done some revision, I had successfully...
[4 replies] Last: I would like to ask.. if i do rand()%4+3, it will select random number... (by jonnin)
Need help for finding the solution and the code of exercise from the book c++ by dissection
 
hello,c++ guys, I find a book from my shelf that called c++ by dissection written by Ira Pohl, ISBN:0-201-74396-5, for learning well, I just want to follow the ...
[2 replies] Last: FWIW, the book is available here: https://doc.lagout.org/programmation... (by dhayden)
by kmce
Question from bjarne stroustrup programming principles and practice
 
Hi, I have been trying to figure out a question from the programming principles book since yesterday and I can not figure out the solution. The question is ...
[4 replies] Last: But I decided to try again, and not have the computer know the number... (by zapshe)
Code simply stops randomly?
 
Hello guys, I am experiencing strange code behavior. So in the institute of my university, we have a "cluster", i.e. thousands of CPU's that we can use to ru...
[17 replies] Last: And keeping a close eye on the weather forecast :P (by MikeyBoy)
Writing 3 types of variables to a 1-D array
 
Hey guys. We have a homework assignment where we have to create a 1-D array to hold the units of food for 7 monkeys. All the data in the file is in the format o...
[12 replies] Last: I had to initialize my array to 0 to get it to work. Not sure why. ... (by MikeyBoy)
Filling a new array of ints with part of a different array
 
Hi, I have an array with x values and 0 values. How can I fill a new array with just the x values? e.g. num[1, 0, 4, 0, 0, 5]; newNums[1, 4, 5]; for (int...
[11 replies] Last: Okay, so it chips away at the string from the beginning by removing le... (by jjordan33)
Access SQL Server witch c++.net
 
Hello, I'm new to programming with c ++. Net. I use lots of C #. I started in new job has an application developed in c ++. Net(VS2008) that read some informa...
[3 replies] Last: Hello!! I'm create a program: #include "stdafx.h" #include "SQL_C++... (by Usiminas)
Calling srand each time before generating random numbers make it more or less random?
 
I need to generate random numbers many times (retrieving elements from different arrays) and it seems the following code produce results that follow a pattern: ...
[12 replies] Last: It generates the seed (and initialises the random engine) only once; t... (by JLBorges)
Possible to dynamically separate input?
 
Hi, Is there a way to dynamically separate string input into different variables? For instance, if I have //pseudo of course string nums = ""; string letts...
[3 replies] Last: #include <iostream> #include <cctype> #include <string> #include <alg... (by lastchance)
order of execution in an expression with commas in C++
 
It is my understanding that the term j = i will be executed before ++i in the statement j = i, ++i; Does the C++ standard guarantee that j = i will be e...
[9 replies] Last: No, the OP just grabbed a random post from S.O. https://stackoverflow.... (by lastchance)
by m2020
Efficient way to covert a file to DAG
 
Hello everyone I have to read a file which describes a circuit and convert it to Directed Acyclic Graph. The files formats looks like: # of nodes 11 # of e...
[11 replies] Last: Good catch. Sorry about that. (by dhayden)
by afSora
Pointers
 
Could someone explain how this code works. #include <iostream> using namespace std; int main () { int firstvalue = 5, secondvalue = 15; int * p...
[5 replies] Last: Thanks for explaining it, I understand it now. (by afSora)
int compare operator as a function
 
Hi everyone. I want to get the int compare operator <, =, > as functions. If I can get them as function, I can treat them as other function's parameter for call...
[4 replies] Last: [quote=CakeByTheOcean]I want to get the int compare operator <, =, > a... (by lastchance)
isODDHigh Function
 
Write your question here. Please I need urgent clue on this: Write a method named, isOddHigh, that takes as input, any array of integers and it returns tr...
[2 replies] Last: #include <climits> // return the largest even number in the array //... (by JLBorges)
Creating and ATM simulation
 
I keep getting this code between line 55 and 60 Unhandled exception thrown: read access violation. **ptrBalance** was nullptr. //bring in our libara...
[7 replies] Last: double* ptrBalance; *ptrBalance += deposit; And what do you thin... (by MikeyBoy)
Functions & Selections
 
I am trying to create a game where: 1.The first player’s turn starts by rolling five six-sided dice. 2.If the average of the dice is less than or equal ...
[1 reply] : Use a " do{....} while(score<50); " loop. (by Zaap)
July 2019 Pages: 1... 34567... 11
  Archived months: [jun2019] [aug2019]

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