Beginners - February 2019 (Page 19)

by cash
random function problem
 
Why isn't my program giving me random numbers each time I print double random(unsigned long int & seed) { const int MODULUS = 15749; const i...
[5 replies] Last: put seed = rand() after srand call. seed is technically randomish bec... (by jonnin)
by ramp00
What does it mean when code builds successfully, but doesn't run
 
Hey! I have a problem with a program not running. What does it mean when the compiling works, but running the program fails? I use Visual Studio 2017 btw. ...
[6 replies] Last: Hmm, yeah I see. Thanks guys! (by ramp00)
My code compiles but will not create output file:
 
I am using Visual Studio 2015. I check the directory after compiling the code and no txt file pops up: #include <iostream> #include <fstream> using na...
[2 replies] Last: Thank you for that. Turns out all i had to do was change to ofstream (by iamyiyaj)
Constructor
 
I'm trying to make a text game like Zork and currently I'm trying to get a constructor to make a randomly generated number. Then with that number, print a diff...
[2 replies] Last: Ohh, ok that makes sense, thank you very much. (by CaptainLupa)
Find coordinates of a rectangle by asking <= 7 queries
 
We are given a hidden rectangle. We can ask the computer a maximum of 7 queries and in each query, we specify a coordinate x,y. The computer then returns the m...
[4 replies] Last: Please somebody help me in xor decomposition problem (by Dum)
by krz
I need help in solving an Array Based Expression Calculator
 
I am not understanding how I can print this array in the form that the question is asking. Please help. Problem: This problem considers specifying an expressi...
[no replies]
Need help reading/sorting/writing data to and from a file.
 
Let me start by saying I know how to read from a file and write back to it, but I am having trouble with picking the best way to go about doing these things. Pl...
[15 replies] Last: I never considered the portability issue when using binary. I actually... (by closed account Ezyq4iN6)
issue with WM_GETTEXT and char buffers
 
Hi! I'm a chemist new to coding and am working on a script to help me automatically process some of my data. The code I'm working on right now involves using WM...
[no replies]
Problem with circular dependicies
 
Hello guys.I am trying to resolve one problem but i can'n.I have two classes: class FileSystemElement and class Folder.Class FileSystemElement contains a pointe...
[9 replies] Last: moving an include to the end of a file tickles my OCD I hear ya. Th... (by dhayden)
Reading numbers from a txt file
 
I am trying to create a function which: 1) Asks for a filename from the user 2) if it exists it takes in the file and prints out the contents of it 3) If the f...
[2 replies] Last: Hello John Davis, I loaded up your program and ran it. What I found:... (by Handy Andy)
The : in function definitions?
 
int addTwoNum(int a, int b) : (bunch of crap goes here) { return (a+b); } What is it called so I can look up information about it? I tried looking...
[4 replies] Last: Thank you for the quick replies. I will look into it. Thanks. (by Darkware)
2048 Game: How to overcome this bug?
 
I am testing it using: int main(){ std::vector<int> v{1,1,1,1}; bool c = game_over(v); if(c){ std::cout << "true" << std::endl; ...
[7 replies] Last: Ah! I have solved it thank you. (by John Davis)
Arithmetic Progression Using recursion C++
 
I wrote c++ code which gets first character of progression (a1) difference (b) and size of progression (n)from user and my code must print arithmetic progressio...
[5 replies] Last: #include<iostream> using namespace std; void arth( int a, int b, int... (by lastchance)
Help answer a problem
 
Write a C++ program that defines a function that prints every “x” character in the string. a. For example, with a string “Hello World” and x = 4, the...
[2 replies] Last: Create a function that takes as its arguments the string and the incre... (by lastchance)
structure and function
 
I am using structure and function combination to print data in the console, but I am not successful, can some one suggest the required changes in the code. ...
[3 replies] Last: cin>>d1.u_star ; Grid is equal to 5 and you which means that your ... (by H00G0)
by Bopaki
I need some help on this function definition
 
I am trying to compile a file personType.cpp and I get this error when compiling operator= here is the error: MalikChapter10\Election Results\personType.cpp:3...
[7 replies] Last: next code candidateTypeImp #include <iostream> #include <string> ... (by Bopaki)
by yat89
Insert value at the beginning and the end of 2d vector
 
Hi everyone. I am new to c++ programming. Given a task to insert zero at the beginning and the end of each row of 2d vector. I had try to code it but errors occ...
[2 replies] Last: Thanks Peter87 . Its work after I insert route and remove vector<... (by yat89)
Function not showing any output
 
Dear friends Can some one tell me why am I not able to print the simple output in the single function defined in the code below. #include<stdio.h> #inc...
[2 replies] Last: @dutch Thanks (by usmannazir)
Default Constructor
 
...
[3 replies] Last: I would do something like this: class date { public: en... (by JLBorges)
OpenGL: Best way to precisely copy pixels of an image to screen?
 
Hi, I am attempting to write a simple 3D OpenGL 3.1 engine (older spec targeted for retro gaming rigs), and I would like to know the most efficient way to do a ...
[3 replies] Last: Its been a WHILE since I did gl, but I do believe it was 2 triangles. ... (by jonnin)
February 2019 Pages: 1... 1718192021... 23
  Archived months: [jan2019] [mar2019]

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