C++ () is a general-purpose programming language created by Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significantly over time, and modern C++ now has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation. It is almost always implemented as a compiled language, and many vendors provide C++ compilers, including the Free Software Foundation, LLVM, Microsoft, Intel, Oracle, and IBM, so it is available on many platforms.C++ was designed with an orientation toward system programming and embedded, resource-constrained software and large systems, with performance, efficiency, and flexibility of use as its design highlights. C++ has also been found useful in many other contexts, with key strengths being software infrastructure and resource-constrained applications, including desktop applications, video games, servers (e.g. e-commerce, web search, or databases), and performance-critical applications (e.g. telephone switches or space probes).C++ is standardized by the International Organization for Standardization (ISO), with the latest standard version ratified and published by ISO in December 2020 as ISO/IEC 14882:2020 (informally known as C++20). The C++ programming language was initially standardized in 1998 as ISO/IEC 14882:1998, which was then amended by the C++03, C++11, C++14, and C++17 standards. The current C++20 standard supersedes these with new features and an enlarged standard library. Before the initial standardization in 1998, C++ was developed by Danish computer scientist Bjarne Stroustrup at Bell Labs since 1979 as an extension of the C language; he wanted an efficient and flexible language similar to C that also provided high-level features for program organization. Since 2012, C++ has been on a three-year release schedule with C++23 as the next planned standard.
Summary: Problem with Euler Method in C++
Hello, I have a very difficult problem for me (a beginner in programming) how to make the version of the euler method presented in c ++ with the void, float functions, so that the program will calculate from the data that I enter during the program...
I am absolutely new to Polymer simulation. I am trying to understand the simulation by analyzing source code written by others.
Can anyone tell me what are the differences between the following three source code in terms of their objectives?
Monte-Carlo-simulation-of-polymers...
Why are struct use for linked list and classes used for binary tree.
honestly what is the different between a class and a struct?
I have a teacher one tell me that a class was a struct on steroids.
but what does that really mean ?
Hi, I'm trying to simulate a 3-body problem with a star at the center of reference system and 2 body orbiting around it using Runge Kutta 4. The 2 bodies perturb each other orbits gravitationally, so my ode system is actually a coupled armonic oscillator and I evaluate the solution of both...
Homework Statement:: I'm working on a personal project to convert objects from a simulation using state vectors for position and velocity to Keplerian orbital elements (semimajor axis, eccentricity, argument of periapsis, etc.). However, the equations I am using do not calculate the...
I am now learning C ++ and trying to learn class and vector. I'm trying to write code, but I got an error.
this is my class and enum class:
enum class state: char{ empty='.', filled_with_x='x', filled_with_o='o'};
class class1{
private:
class class2{
class2()...
I want to generate random numbers in C++. I do not want to use C library function (`<cstdlib> <ctime> (time.h)` ) and class. So I cannot use `rand()` function in C. I want to generate random integer numbers and I guess I can use `<random>` library in C++11. How can I use this generate random...
To simulate the trayectories of solar systems around a black hole (i.e. a galaxy) I have 3 classes in C++: cSystem, cBlackHole and cGalaxy. cSystem assigns initial values of position, velocity, etc to a solar system. cBlackHole does the same but just for the black hole. And cGalaxy mixes...
I have written a C++ code in Visual Studio 2019 that requires an input tab-delimited text file and outputs a text file that is also tab-delimited. The data within the text file are stored in a vector and then it will perform calculations, whose results will then be written in a text file as...
I'm not at all C++ literate, but I need to understand what a C++ code is doing for a math problem regarding the Stieltjes polynomials.
Especially, I want to know what is happening to the "num" and "den" in the code; the code is in this link:
Stieltjes
Hello everybody,
I am a master student in Theoretical Chemistry and I am working in the DFT realm. Both TDDFT and DFT applied to extended systems (eg. using QUANTUM ESPRESSO). Of course I work with these softwares from a end-user point of view, not as a developer.
But anyway, even if some of...
Hello All,
I took it upon myself to create a tool for my job that xref 2 excel worksheets on 2 different workbooks. Customers send us parts and they're wanting the leadtimes for them. We have a weekly report that has all part numbers with their leadtimes. My goal is to create a GUI in C# that...
I don't have a debugger yet, but my company is getting one...
In the mean time, I've been un/commenting out parts of Mbed's code. Their Hello World program is available from this website, and it can be used directly in their online IDE by clicking "Import Program"...
I’ve been looking for a certain type of software that can host programming (preferably C or Python) and other process that I’m going to need such as DSP, DSP filters, diagrams (3D graphs, charts,…), and text editing within the same file. It’s mainly so that I can incorporate and use each one...
My matrix text files can vary from 1x1 to 10x10 (Another file will be given when the code gets tested but it's all square matrices)
I'm stuck here.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main() {
const int MAXI = 10;
int x, y, z...
I have computed the total length of a 3D triangle and its area. The code is shown below.
I want to use file output instead of cout. The file name, cw2task1output, was just given as part of the task, in this case should I make an empty text file named cw2task1output then attach it to the resource...
Hey guys,
I parallelized my code, written in C++, with the MPI library. Unfortunately, the speed-up I get saturates at x6, with increasing number of cores. Whereas, in theory, the speed-up should really be nearly linear.
To understand where the bottlenecks come from, I drilled down the code to...
All the white space among words in a text file was lost. Write a C++ program which using dynamic programming to get all of the possible original text files (i.e. with white spaces between words) and rank them in order of likelihood with the best possible runtime.
You have a text file of...
Homework Statement
I have a complete code that calculates distances between point 1(x1,y1,z1) and other points(from 2nd up to more than 100) and the nth point that results in minimum distance and the minimum distance between point 1 and nth point. The code is below.
The code is 100% correct...
Homework Statement
I have successfully opened and discarded the headers. Then I calculated the distances between point 1 and others and the minimum distance as well. However, I am not sure how to make the code work for more than 4 points. The attached text file is what I am trying to read and...
Homework Statement
Write a program that can read an input file with a simple header.
The Attempt at a Solution
#include <iostream>
#include <fstream>
using namespace std;
int main() {
ifstream inFile;
inFile.open("Data");
//Check for error
if (inFile.fail()) {...
if I want to read to integer a and b and they are in a formation of a@b, I CAN SIMPLY USE
scanf(%d@%d,&a,&b)
to read the input. But how should I do that in c++(with cin)?
Greetings,
for a Monte Carlo simulation of N hard spheres, I want to set up the initial configuration as a fcc lattice. I am thinking about how to do it most efficiently.
Here is the lattice structure:
The 3 lattice vectors, each one pointing to a different type of the 12 nearest neighbors...
Homework Statement
A house has n x m rooms (n and m natural numbers, n>=2 and m>=2) and is represented as a 2 dimensional Array with n rows(0 to n-1)and m columns(0 to m-1).The room at line i( 0 <= i <= n-1) and column j ( 0 <= j <= m-1 ) is identified by the pair of numbers (i,j).All rooms...
Homework Statement
Write a BinaryTree Class using these specifications:
A Class Node represents a standard node of the tree with fields and a constructor like given below:
int start, end;
const Complex* value; //I will provide more information about Complex later because that was the...
Homework Statement
Hello, I am attempting to use the velocity Verlet algorithm of integration applied to the solar system in c++. My goal is be able to use the outputted position components in a plot to see if the trajectory of my object is elliptical/parabolic/hyperbolic resulting from the...
Hi everybody,
I'm writing some algebra classes in C++ , Now I'm implementing the modified sparse row matrix , I wrote all most all of the class, but I didn't find the way saving computing time to perform the product of two Modified sparse row matrix .. if you don't know it you can read in the...
Create a class DecimalN which holds decimal numbers using dynamic arrays.
Implement a constructor DecimalN::DecimalN(char* decimal) so that it can be created like for example DecimalN number("23.5698").
Create two class functions (methods) that given the number n it shift the number n places...
Homework Statement
I am quite new to C++. I have completed my C course and am now taking a C++ course at my college. The first problem i encountered is with classes and custom made constructors. In the first part of the problem I am supposed to create a class with a field which is a dynamic...
Homework Statement
[/B]
Write a function fForceOfGravity, with return type double and with two double parameters for mass (m) and gravity (g). Parameter gravity must be initialized to 9.81. The force of gravity is given by the formula F=mg. Call these functions in the main () as follows:
cout...
This is what I did but I'm getting an infinite loop of the reversed string whenever I run the program. I don't know why
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h> /* for fork() and getpid() */
#include <sys/types.h>
#include <iostream>
using namespace std...
ok i wrote my code but the whole file gets deleted instead of the required values.
else if(option==5)
{
int rno;
fstream w1;fstream e1;
e1.open("temp.dat",ios::in|ios::out|ios::binary)...
Hi everybody,
I seem to be having trouble coding a function that returns the integer value at which degrees celsius is equivalent to degrees fahrenheit. Here is the question:
Write a function that will find a temperature that is the same in both Fahrenheit and Celsius. First define two...
I began by creating 2 classes. A book class and a course class that contains any necessary info about the book and course respectively
class bookClass{
private:
string theISBN;
string thebookName;
string thebookAuthor;
double thebookCost;
int...
I have been working on implementing a solar system system simulator in C++ - but am getting incorrect results on the order of 10^10 km, and it seems that the planets are moving directly away from the sun. I suspect that there is a mistake in the integrator (Velocity Verlet) that I have posted...
I'm trying to integrate a simple function (x*y) using the Romberg method.
Question 1:
I want to integrate only x and maintain the argument y present in the rest of calculation, like a global variable. In fortran 77 I would use common.
Question 2:
How to integrate using arguments in the...
Homework Statement
Find the are of the cylinder, by creating a program in C++.
2. The attempt at a solution
So far I have:
#include <iostream>
using namespace std;
const double PI = 3.14159;
class point
{
protected:
int x;
int y;
public:
point()
{
}
point (int xvalue...
I have Ettus B210 and trying to add 1 line configuration file "/etc/security/limits.conf" which will allow UHD drive to set priority.
So , I typed this command to edit file: gksudo gedit /etc/security/limits.conf and add:
#@student hard nproc 20
#@faculty soft...
Homework Statement
Okay, this one is a bit big, and I'm attempting a translation, so I'm going to post a TL;DR version at the bottom just to be sure. Anyway, here goes:
While doing an experiment, we write down the values of a physical/natural size y, for various values of a physical/natural...
Homework Statement
Okay, I'm going to "cheat" a bit and add two programs here, but I don't want to clutter the board by making two threads. Anyways, here goes:
(1) The value of the sine of an angle, measured in rads, can be found using the following formula:
sin(x) = x - x3/3! + x5/5! - ...
I want to open a window in just c++. Now I can do this easily with SDL with just 2-3 lines of code, but I want to learn how to open a window in c++ without any library, I mean like plain c++ nothing else. I searched this on google but results yield nothing of my interest.
There has to be a...
Hi
I'm studying 2nd year for a bachelor's degree in physics and I'm interested in programming (Beginner C++ programmer). I have already done simulations like harmonic motions, Ising model etc but I know this can go further and I need help with that. I use Ubuntu for programming with c++. (GCC...
I've taken a class in C++ and we used Bjarne Stroustrup's Programming: Principles and Practice Using C++. We only got to the point to where we were just starting to learn about pointers, so I still consider myself a beginner. C++ is my first programming language.
I really like how Bjarne...
My program only requires that I take C++ or Fortran. It seems like most students I have asked are only taking C++, I'm thinking of doing both. I'm planning on asking my advisor as well, but so far I've been really underwhelmed with my meetings with him. Thoughts? Thanks in advance!
I am familiar with linking external libraries in IDE like Eclipse, Netbeans etc. But in my college they use use vim for programming on Linux. To learn more about vim editor I installed it on my home computer.I can compile basic C++ programs on it with one or two .cpp/.h files. I think it is...
Homework Statement
I am trying to solve a problem that asks me to give the total days between two dates. I have to take care of the some matters between those two dates such as leap years and the way of inputting the years by the users. (For example, if you input 1 and 17, the code will still...