C++ Definition and 813 Threads

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.

View More On Wikipedia.org
  1. Const@ntine

    Comp Sci C++: Method of Minimum Squares used for System Solving

    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...
  2. N

    C/C++ How Can I Convert Quicksort from Java to C++?

    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...
  3. Const@ntine

    Comp Sci Function Derivatives & Sines (C++)

    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! - ...
  4. ChrisVer

    Tutoring C++ in HEP: Challenges & Common Questions

    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...
  5. ChrisVer

    C/C++ Understand Bitwise Operators in C++

    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...
  6. D

    C/C++ C++ Homework Help: Calculate Product of Numbers

    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...
  7. B

    C/C++ How to open a window in just C++ (g++ linux) ?

    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...
  8. N

    C/C++ What is the Precedence of Mathematical Operators in C++?

    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 /?
  9. A

    C/C++ C++ program for give equations and error rectifier give program.

    #include<iostream.h> #include<math.h> #include<conio.h> void main() { int n,fact(); float LAM, MU=3, RO, C=0.1, N=10, F1=0, EXX, EWQ; clrscr(); for (LAM=0.1;LAM<=1.1;LAM=LAM+0.1) { RO=LAM/MU; EXX=2/(MU*MU); for(n=1;n<N-1;n=n+1) F1=F1+(N-n)*pow(LAM*C,n-1)*exp(-LAM*C)/fact(n-1)...
  10. AHashemi

    C/C++ Optimize C++ to use for computational physics?

    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...
  11. Z

    What is the best textbook for learning C++?

    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...
  12. LeftMyHeartInErebor

    Courses Choose C++ and Fortran: Advice Needed

    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!
  13. N

    C/C++ How to read a list of USB from C++ in ubuntu OS?

    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.
  14. E

    C/C++ Replacing stoi in C++ program for converting string to integer

    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...
  15. B

    How can link external libraries from the cmd?

    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...
  16. Leonardo Machado

    C/C++ Extracting information of data in column format using C++

    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...
  17. Hughng

    Comp Sci Difference between two dates C++

    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...
  18. S

    C/C++ Solve C++ Pig Dice Game: Aragorn Wins!

    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...
  19. N

    What are the areas of expertise for NumberSix?

    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...
  20. E

    C/C++ Need help with C++ program (Implement a PrintMenu() function)

    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...
  21. E

    C/C++ Troubleshooting C++ Program: Understanding usrStr and userInput Functions

    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...
  22. ExplosiveMercury

    C/C++ How to Create a Hosted Network Program in C++?

    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 () {...
  23. Hughng

    Comp Sci Unmash a string in C++ using recursion

    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...
  24. sukalp

    About computers and being good at coding....

    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...
  25. A

    C/C++ Getting Started with C++ (for N-Body Simulations)

    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...
  26. sukalp

    Exploring Computer Engineering Courses: Self-Study vs. Classes After High School

    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...
  27. E

    C/C++ How to Properly Resize and Populate a Vector in C++ Without Using push_back?

    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...
  28. sukalp

    C/C++ Question about learning C++ Linked Lists before Stacks....

    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
  29. Hughng

    Comp Sci C++ Question: Calculate the Investment at time n

    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...
  30. Kingyou123

    Comp Sci Infix to prefix conversion C++ Help

    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...
  31. Kingyou123

    Comp Sci How can I remove the nth member in the Josephus Problem using C++?

    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...
  32. A

    C/C++ Print Theater Seats in C++: numRows & numCols

    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...
  33. sukalp

    C/C++ C++ Stack and Queue Tutorial for Beginners

    is there any tutorial which covers stack and queue in c++. i am not able to understand it is getting difficult for me .
  34. J

    C/C++ Problems with C program- Not C++ and not Java

    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 */...
  35. sukalp

    C/C++ Studying C++ programming topics

    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?
  36. M

    Comp Sci Program in C++ calculate area and perimeter of rectangle.

    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...
  37. levadny

    Dynamic Arrays (One, two, three dimensions)

    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]...
  38. davidbenari

    C/C++ Where Can I Find C++ Mathematical #Includes for Common Functions?

    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...
  39. Prof. 27

    Comp Sci Problem with C++ Information Structures, Pointers, Arrays

    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...
  40. cpscdave

    C/C++ WxDev C++ and Console outputting

    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...
  41. rolotomassi

    C/C++ C++ matrix boundary condition problems

    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...
  42. ChrisVer

    C/C++ Why Am I Getting Linker Errors When Using Const Methods in C++?

    I have the following class Vec2D: #ifndef Vec2D_H #define Vec2D_H class Vec2D { private: double fX; double fY; public: Vec2D(); Vec2D(double x=0, double y=0); ~Vec2D() {}; double const X(); double const...
  43. FallArk

    C/C++ How can I create a recursive function to mimic long division in C++?

    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?
  44. FallArk

    C/C++ Help with this recursion function in C++

    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())); }...
  45. FallArk

    C/C++ What is the Functionality of this C++ Code?

    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() {...
  46. S

    C/C++ Why Do My Simulated Orbits Appear as Spirals in C++ Runge-Kutta Simulation?

    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...
  47. O

    C/C++ Resize Vector and Populate with Integers for C++ CountDown Problem

    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...
  48. S

    C/C++ Runge-Kutta methond for n body C++

    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...
  49. N

    C/C++ C++ Vectors: Finding Values in vectors

    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...
Back
Top