General C++ Programming - March 2022 (Page 5)

registration using do-while activity
 
Write a program that can register a user with name, address, age, course and gender. Then the system will ask the user if she/he need to register another user, ...
[12 replies] Last: Do you mean for L29: g += '\n'; (by seeplus)
by frek
Missing element (1,2)
 
Here's the exercise: An array A consisting of N different integers is given. The array contains integers in the range [1..(N + 1)], which means that exactly o...
[22 replies] Last: Array or vector doesn't matter. By calculating the difference on each ... (by againtry)
Largest sum issue (1,2)
 
Here the method findSumMax must return largest sum of any two elements in given vector of positive numbers. For example, the largest sum of vector {5,9,7,11} is...
[20 replies] Last: [quote=mbozzi]nth_element might be better than partial_sort Yes, you... (by lastchance)
vector versus pointer access
 
For the following code: for (int i = 0; i < 4000; i++) { for (int j = 0; j < 5000; j++) { table.at<double>(i, j) = 99; } std::cout << endl; } I b...
[12 replies] Last: Please explain some about the bigger picture. You can't effectively r... (by mbozzi)
Part2 - Math: how calculate the line dots?
 
these topic is the second part of https://www.cplusplus.com/forum/general/281522/ heres the final code for draw the line: #include<math.h> #include<iostream...
[7 replies] Last: the black fill is the Window Console Backcolor. (by Cambalinho)
Trouble reading CSV file
 
Hello!.. I have .csv file that I'm reading from that looks something like this, for example: 0,0,0,4,4,3 1,2,0,0,2,2 0,0,2,2,0,-1 I'm using std::getline() to...
[11 replies] Last: Works perfectly now. Thank you all for the help, really appreciate it. (by brianbathorycpp)
by Cplusc
argc and argv with mpi and command line argument
 
I'm working on a code which takes 3 arguments as command line. I applied the MPI on the same code and tried to run it using mpiexec -np 2 codename.exe, but it s...
[4 replies] Last: Your example is NOT using commandline arguments. You are re-directing... (by lastchance)
how to find the median in c++
 
from smallest to largest this is what I have if(grades < grades && grades < grades && grades < grades && grades < grades ) { cout<<grades <<"...
[2 replies] Last: [quote=salem c]C++ has many toys to play with. Also, std::partial_sor... (by lastchance)
by medvih
Atomic load in destructor
 
Hello there, This is my first post in this forum and I have been trying to understand on my own what the presenter in that cpp conference is trying to say when...
[1 reply] : Thanks for sharing informative information https://www.upsers.page/ (by Smith441)
Trouble shooting slow computer. Please Help!!
 
I'm running the same code on 3 machines, but it lags on 2 machines. How would I trouble shoot this problem? https://www.dgcustomerfirst.page/
[8 replies] Last: Trouble shooting slow computer. Please Help!! So far so good because... (by againtry)
by demhat
scanf error!
 
#include <stdio.h> #include <stdlib.h> #include <time.h> int guess(void); int main(){ srand(time(NULL)); int y,input; char again='y'; while...
[4 replies] Last: scanf(" %c",&again); this work the program correctly THANKS! (by demhat)
by demhat
program execution wrong!!
 
#include <stdio.h> #include <stdlib.h> int perfect (int number); int main(){ int num; for(num=1;num<=1000;num++){ // num<=2000000 takes 5509.37...
[6 replies] Last: I changed code with #include <stdio.h> #include <stdlib.h> int perf... (by demhat)
rectangle overlay
 
I am trying to solve this problem, than given 2 rectangles as below: +===============+ (x2,y2) | | | | (x1,y1)+===============...
[6 replies] Last: Thanks a lot, lastchance, for your valuable inputs here :-) (by leo2008)
Subtraction underflow???
 
Hello all, I am writing a class called bigInts that deals with bigInts (dynamic arrays of shorts up to 40 digits) and I am having some trouble overloading t...
[5 replies] Last: Big integer Addition and Subtraction are easy, Multiplication is not t... (by againtry)
i'm trying update a DrawLine3D(), but how use max()?
 
from http://members.chello.at/easyfilter/bresenham.html i'm trying draw a 3D Line: void plotLine3d(int x0, int y0, int z0, int x1, int y1, int z1) { int...
[12 replies] Last: using these function: vector<point> GetLinePoints(point Origin, point... (by Cambalinho)
blank
 
blank
[13 replies] Last: If you were a true beginning C++ coder, someone who had never done any... (by deleted account xyzzy)
JsonCpp parse issue
 
I have created a .json file, and need to read it and append some new information to it. This is in JsonCpp library, and I have no issue creating the new inform...
[7 replies] Last: Stilll no self-contained compileable example, as was previously and po... (by deleted account xyzzy)
I am trying to overload << operator to seinding the command
 
Hi I have a bachelor project about DJI Tello Drone and I wanted to overload this "<<" operator so that I can call the function like this: int main(){ Tello d...
[5 replies] Last: Not sure what you are aiming for. To be able to write: drone << comm... (by JLBorges)
If Statements With Multiple conditions
 
char grade = 'F' ; if( avg_grade >= 89.5 ) grade = 'A' ; // >= 89.5 A else if( avg_grade >= 79.5 ) grade = 'B' ; // 79.5 – 89.4999... B else if( avg_grade >...
[1 reply] : This is not the first time this problem has cropped up. The usual reas... (by againtry)
by frek
Find algorithm task (1,2)
 
The exercise says: https://imgur.com/a/Zm7Q8hx And here's my first solution: #include <iostream> #include <vector> #include <algorithm> bool solution(std::v...
[24 replies] Last: LOL, nice. I had forgotten about the specialist integer bit-twiddling ... (by Duthomhas)
March 2022 Pages: 1... 34567
  Archived months: [feb2022] [apr2022]

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