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.
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...
I have never done Java but my professor says it is similar to c++. I am trying to convert quicksort in java and covert it to c++.
I don't know if this is correct or not. Here is the code my professor gave us.
.....Java......
public static void quicksort(char[], int left, int right)
{
int...
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! - ...
Hi people,
This semester I am going to be a tutor for a master course class on C++ in HEP...
I would like to listen from people with more expertise on the field:
1. What do students find (in general) difficult to understand in C++ from your experience with teaching it? In my case I think the...
Hi guys, I have the following piece of code but I am not sure I understand if I get what it does correctly.
static const unsigned int m_nBits = 6;
static const unsigned int m_nRanges = 4;
max = SOMENUMBER;
if( max >= (1 << (m_nBits + m_nRanges - 1) ) ){
doStuff()
}
In fact I'm trying to...
I am not looking for an answer, just guidance...
My assignment is to ask the user for a number between 3 and 10 (inclusive). Using a loop, calculate the product of the numbers between 2 and that number. For example, if the user chooses 5, the result would be 2 x 3 x 4 x 5 = 120.
Sample run...
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...
Which has precedence over each other * / - + because i am working on this problem for c++ but without coding it but instead writing it out on paper. For example: 7+3*4/2-5-3+4
Which will have precedence - or /?
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 trying to use C++ (eclipse in Ubuntu OS) to read USB connection. Usually, on the terminal window, I can use command "lsusb" to see the list. Now, I want to do the same way with C++.
can anyone help?
Thank you very much.
What can I use to replace stoi since the homework program won't accept it? I'm trying to read a string and display it as an integer. I know I have to use stringstream but have no idea how.
//ReadData.cpp
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <string>
#include...
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...
Hello friends, how are you ?
Today's question is: How do i choose the data i want to extract from a file in c++ ?
I have this data file in columns format, something like:
x y z
1 2 3
4 5 6
7 8 9
I know there is the command file.getline() , and this...
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...
Hello!
So for an assignment, we have to write a program for the pig dice game.
You are to finish the program below that implements the dice game PIG played by 2 human players.
Pig is a dice game where each player during their turn rolls a 6-sided die. If the player rolls a 2 through 6, they...
NumberSix solves problems using mathematics and mathematical software. He has worked on gesture recognition, speech recognition, video compression and several other highly mathematical areas. He has expertise in mathematical modeling, statistics, and linear algebra. He has many years of...
Implement a PrintMenu() function, which has a string as a parameter, outputs a menu of user options for analyzing/editing the string, and returns the user's entered menu option. Each option is represented by a single character.
If an invalid character is entered, continue to prompt for a valid...
I'm having trouble understanding how to use the "usrStr" or how to use the userInput in both of my functions. I know the problem with my code, i see that when i call the OutputWithoutWhiteSpace(userInput) function it works fine but it adds the extra characters
first sentence = 46 characters...
Hi, I've been recently started programming, and wanted to make program I can use in everyday life. I use CMD hosted network every day on my other PC, and wanted to make program in witch I can stop/start/restart hosted network.
This is current progress:
#include <iostream>
int main () {...
Homework Statement
MUST USE RECURSION TO SOLVE THESE PARTS.
Part A: Have a user input a string. Then display this string smashed up as follows: display the first character in the string, then the last, then the second, then the second to last, then the third... So if the string is “abcdef”, it...
i wanted to know how to become computer king of world if we have coding talent
like making cool apps,software,making technical software machines like robotics.
can we become computer king by challenging bill gates
like what they did to world
we can do in 1 day
not by copying but following...
Hello all. I don't really know what to exactly ask from any of you other than how I should get started with C++ programming to hopefully create N-body simulations down the road. How to exactly start, I'm not entirely sure.
For a little about what I know, I know python extensively. I use it...
i wanted to ask you after high school passing grade 12
when we do computer engineering courses like Bachelor of computer applications, Bachelor in computer science,,B of technology
we can do self study or classes is required for these courses
as computer engineering courses will have subjects...
Resize vector countDown to have newSize elements. Populate the vector with integers {newSize, newSize - 1, ..., 1}. Ex: If newSize = 3, then countDown = {3, 2, 1}, and the sample program outputs:
3 2 1 Go!
**I want to do this WITHOUT push_back**
#include <iostream>
#include <vector>
using...
i wanted to ask you that in c++it is important we should learn linked list before learning stack,queue that i wanted to know while studying data structures
Homework Statement
Pretend you have some money (ha!) that you want to invest in the stock market. Ask the user for:
The initial investmentYearly estimated market growthHow much (if any) you wish to withdraw from the account per yearThe desired level of money you wish to get
The growth...
Homework Statement
I'm trying to create a infix to prefix converter and prefix to infix converter. I have used a example in my textbook, but it's for a infix to postfix conversion, I figured if I reversed the equation it would give the prefix. Right idea?
2. The attempt at a solution
string...
I'm trying to write a program that plays the Josephus Problem.
I'm running into a problem in the remove_nth_member part:
string Cqueue2::remove_nth_member(int n) //for Josephus problem to remove a member
{
string name;
int i;
int index;
int start...
Given numRows and numCols, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print a space after each seat, including after the last. Ex: numRows = 2 and numCols = 3 prints:
1A 1B 1C 2A 2B 2C
This is what I have so far, but I can't figure out how to...
A user types a word and a number on a single line. Read them into the provided variables. Then print: word_number. End with newline. Example output if user entered: Amy 5
Amy_5
#include <stdio.h>int main(void) {
char userWord[20] = "";
int userNum = 0;
/* Your solution goes here */...
I wanted to know in c++
when we learn advance c++ like class,constructors,inheritance,data file handling we should know how to implement a class ? in c++ before studying these topics?
1. Homework Statement
calculate the area and perimeter of 2 rectangles(two objetcs and one builder), print the sides, area and perimeter, the function printrectangle must identify which side belongs to base and height...
the teacher suggest this in private: float side1 float side2
and this in...
Dear Friends!
My post about dinamic arrays. For example little bit code.
// size
int const X = 5;
int const Y = 4;
int const Z = 3;
// one dimension array
printf("\nOne dimension\n");
// array of pointers
int * Arr;
// create array
Arr = new int [X]...
I've just begun learning c++ and what is very different from MATLAB (e.g.) is that one has to use include files.
I was wondering if there's somewhere I can download mathematical #includes which already has stuff like matrix inverses, trigonometric functions, etc, defined.
I think numerical...
Homework Statement
So I'm getting an error when I try to compile my C++ code:
Debug Error
Abort() has been called
I have commented the code reasonably well, but the idea of the program is to take a file, separate the contents in each line to a part of a structure containing:
Product Lookup...
So I ran into a problem with my Python implementation and have decided to rewrite my program in wxC++ instead of wxPython.
Starting to make some progress (I keep forgetting to put ;'s at the end of lines DAMN YOU PYTHON!)
ANyone know how I can output to a console? I was using LiClipse for...
I have created a matrix with a class called Lattice. The lattice is filled with objects of type 'Dipole' which is created with another class. The problem I am having is with boundary conditions when I look for a neighbour. e.g If i pick a dipole on the top row, I want its 'above' neighbour to be...
When I do things like cout << 1/3; in C++, it will typically output 0.333333, but the actual answer should be 0.3333333 with an infinite amount of 3s, how should I make a function such that will mimic this division recursively?
I need to make a piece of code that reverse a string user input.
My solution:
#include <iostream>
#include <string>
using namespace std;
string reverseMe(string tmp) {
if (tmp.length() == 1) {
return tmp;
}
else {
reverseMe(tmp.substr(1, tmp.length()));
}...
The way the classes and functions are named confuses me. What is the program trying to do?
class Y {
long y;
public:
Y() {
y = 4;
}
long get(long yy) {
long ret = yy * y;
y = yy;
return ret;
}
};
class X {
long x;
Y y;
public:
X() {
x = 7;
}
void Xx(long xx) {
x += y.get(xx);
}
int get() {...
Hi! I have this code in C++ that simulates 2 body interacting through gravity using Runge-Kutta 4th order method. I plotted the trajectory of the 2 bodies and as you can see in the first picture they seems to be what I expect, 2 circles. But when I zoom in on one of them (second image) it looks...
Problem Statement:
Resize vector countDown to have newSize elements. Populate the vector with integers {newSize, newSize - 1, ..., 1}. Ex: If newSize = 3, then countDown = {3, 2, 1}, and the sample program outputs:
3 2 1 Go!
Code I have so far, it works but I don't understand how to populate...
Hi! I am trying to simulate the rotation of a planet around a star, using the 2nd order Runge-Kutta method (I am starting with this and I will try 4th order later, I am new to this topic). I have this code but it doesn't work. When I plot y(x) I should get a circle, but I don't get it. Any idea...
I would like some help or guide to if i am going on the right track on my program ***Set numMatches to the number of elements in userValues (having NUM_VALS elements) that equal matchValue. Ex: If matchValue = 2 and userValues = {2, 2, 1, 2}, then numMatches = 3. ***#include <iostream>
#include...