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

    C/C++ Why is my C++ regex not matching?

    I am wondering why this is not matching. I tested my regular expression on notepad2 and it matches fine. std::string line = " 10 0 5 0"; std::regex rgx("\s+\d+\s+\d+\s+\d+\s+\d+"); if (regex_match(line, rgx)) { // do something... int a = 2; }
  2. C

    C/C++ Calculation in C++: B-C && (B-A) /C - Which Answer is Right?

    I am doing my homework regarding calculation in c++. I am confused by the below question. Int A=2 B=3 C=4 B-C && (B-A) /C I think the answer is 0 because the first part is negative. But,my friends say the answer is 1 because -1 not mean false. I want to ask which answer is right? Thanks.
  3. G

    C/C++ What does the space above 'E' represent in a C++ deque diagram?

    I have a minor question about this diagram I'm hoping someone can clear up for me. The deque has initial capacity 4. The following operations are performed. push_back(1) push_back(2) push_back(3) pop_front() pop_front() push_back(4) push_front(5) push_front(6) push_front(7) final answer...
  4. M

    Comp Sci Calculating GPA with Loops in C++

    Homework Statement I'm to write a program that calculates GPA using loops to allow numerous inputs and using Error checking to be sure that inputs are valid. I'm having trouble figuring out how to make my loop repeat if a the input is invalid. And I'm also having a little trouble with the...
  5. J

    C/C++ Jamin2112 attempts C++ solutions

    Okay, in this thread I'm going to attempt some problems and I would appreciate it if the C++ purists could offer feedback. I Googled to get some ideas for problems. Here's a preview: Eliminate whitespace from a string Remove duplicate characters from a string (e.g. "AAA BBB" -> "A B")...
  6. M

    Comp Sci Simple input output program C++

    I have a homework assignment that requires me to write a program in c++ to calculate GPA. The assignment wants then input of the grade to be in terms of just A B C, etc.. I'm just having trouble assigning a number value to the user input ie when the user inputs an A for their grade, I need the...
  7. J

    C/C++ Critique of C++ code for encoding and decoding text

    These are some functions I'm using to encode and decode text. bitstring returns a string of bits representing the ascii values of the characters in the string passed to the function. For example, passing in "Hi" changes it to "0100100001101001" since (int)'H'=72=01001000 and...
  8. K

    C/C++ How to Port a C++ Project into Android NDK?

    Hello All, I know that this post is very old, but I have a similar question. I believe that it is very relevant and there should be copious material on the net, but I have been unable to find it. I am trying to port a C++ project into Android. My project uses NTL, GMP, and OpenSSL. I am...
  9. U

    Comp Sci To write a C++ program to find the factorial of a number

    Homework Statement To write a C++ program to find the factorial of the number input 'a'. Homework Equations the factorial evaluated is denoted as 'f' i is the counter The Attempt at a Solution Pls check if my program is correct...(here f is the value of factorial and a is the...
  10. C

    C/C++ Why am I getting a Permission denied error when compiling my c++ code?

    Hi, I'm having a serious trouble when I compile my code : #include <iostream> using namespace std; int main() { string nom("x"); cout << "Vous avez quel age ?"; cin >> nom; cout << "Vous avez-vous donc" << nom << "ans?" ; return 0 ; } Here's the resume ; I click on compile&run...
  11. 2

    Stick with C++ or learn something different?

    Hi. I am finishing my last year in High School and I have a question about programming. For a year or two I had been taught Free Pascal but the last year (grade 12) we have been taught some C++. My C++ knowledge is not as wide as it could or probably should be but I am familiar with the basics...
  12. mishima

    Learning c++ programming through physics?

    I was wondering some things I could try to increase my skill in programming using physics problems. I'm not interested in a physics engine or anything super advanced like that, just some fun programming projects (ie the physics makes it fun, for me). I would say I'm still a beginner in C++...
  13. Vorde

    C/C++ Solving C++ Array Issue in Matrix Program

    Hello all, I'm not really a programmer at all, but I learned c++ for a while so I can do basic stuff. Having just finished my linear algebra class I suddenly had an urge to write myself a simple matrix solver. I knew it wouldn't be easy (especially because of my lack of skill) but I was...
  14. U

    C/C++ Karnaugh Map C++ Simplification: 4 Var Output w/o Don't Care Terms

    I need to make a karnaugh map for 4 variables(there is no need to involve don't care terms) which gives the output as the simplified function. There's no need to literally display the map itself I only need an algorithm that takes the input as min terms and displays the simplified output. Anyone...
  15. E

    C/C++ How to Pass a 2D Array in C and C++ for Numerical Computing

    Hi I have this small doubt. i am not good in C . i like to bring i,j,pi values to subroutine and bring back Asi to main program. how to write ! Plz help.. #include <stdlib.h> #include <math.h> double A_operate(int i,int j) void main() { double Ai, pi[10][10],r[10][10]; int i,j,n,m; n=6...
  16. N

    C/C++ How can I parallelize my C++ code to utilize multiple cores?

    Hi I have written an extensive simulation in C++ and when I run it on my quad-core machine, only a single core is used (on Windows). This is because my code is not parallelized. I'm not familiar in any way with code running in parallel, except in Matlab where is happens almost...
  17. S

    Comp Sci Help with C++ Strings: Create a Class Function to Return a String

    I want to know, how to make a CLASS FUNCTION to return a STRING. For example, taken that all variables are declared correctly. string personType::get() const { return firstName + " " + lastName; }
  18. A

    C/C++ How to Handle an Infinite Loop in C/C++ Code?

    Hello there! I typed this code and saved it as a .c file #include<stdio.h> #include<stdlib.h> #include<conio.h> int main() { int a; while(1) { if (kbhit()) { system("cls"); printf("%d...
  19. T

    C/C++ Help with Probabilities & C++ Programming

    I am not sure how to assign probabilities to variables do you think you guys will be able to help me?
  20. J

    What are the Best Books for Learning C++ on Your Own?

    I am currently in high school and doing a lot of self study. I plan on going into physics in university and I was thinking about learning code, or at least becoming familiar with it. I have decided on C++ and I was wondering what are the best books for learning it on one's own. I don't know if...
  21. T

    Comp Sci Sorting array into ascending order in C++

    Homework Statement a. Define an array with a maximum of 20 integers values, and fill the array with numbers input from the keyboard or assigned by the program. Then write a function named split() that reads the array and places all zeros or positive...
  22. S

    C/C++ What is the significance of this C++ code and what does it do?

    Hey guys. I just want to see if I am indeed "seeing" the significance of the code that is to follow. I will follow it with a brief explanation of what I thought the code did. Thanks in advance. const int N = 15; bool table[N]; int i = 0; while (i < N) { table[i] = true...
  23. trollcast

    C/C++ How Can I Implement Big Int Functionality in C++ for Project Euler Problems?

    Hi, I'm working my way through the project euler problems in c++ and I've got to one where you have to sum 100 numbers that are each 50 digits long to find the first 10 digits of the sum. Obviously I could solve it by summing each of the figits in turn then work with them to deal with...
  24. S

    C/C++ Boolean array to identify prime numbers - C++

    Hey guys, just looking for an explanation for the following algorithm. It is in my textbook, and there isn't really an explanation. I don't really see how the algorithm works, but I will add what I do know, and hopefully one of you can help. Thanks. //this initial declarations produces an...
  25. B

    Comp Sci Understanding C++ Linked List Code: Node Structure and Pointers Explained

    Homework Statement Hello, just having a bit of trouble understanding this bit of code: typedef int Item; struct Node { Item data; Node* next; }; typedef Node* NodePtr NodePtr hdlist = NULL; Homework Equations None. The Attempt at a Solution I understand that...
  26. I like Serena

    The C++ Programming Language by Bjarne Stroustrup

    Author: Bjarne Stroustrup Title: The C++ Programming Language Amazon Link: https://www.amazon.com/dp/0201700735/?tag=pfamazon01-20 Prerequisities: Contents:
  27. I like Serena

    Numerical Recipes in C++ by Press e.a.

    Author: William H. Press, Saul A. Teukolsky, William T. Vetterling, Brian P. Flannery Title: Numerical Recipes in C++: The Art of Scientific Computing Amazon Link: https://www.amazon.com/dp/0521431085/?tag=pfamazon01-20 Prerequisities: Contents:
  28. A

    C/C++ C++ Problem with accessing elements of a character

    Hey guys, I'm having trouble with sampling data from a force/torque sensor. I'm using Serial Com to receive the readings from the sensor, which is stored in a character of with 45 individual elements. What I'm trying to do is to pick out pieces of these data and store them separately. I'm...
  29. W

    Comp Sci Scoring Blackjack in C++: Handling Aces in a Card Game Program

    Homework Statement I am writing a program in c++ where it inputs card values from the user and stores it in a char type variable. valid inputs are numbers 1-9, t,k,q,j for ten, kind, queen, jack respectively and a for ace. after inputting all the values the program goes like this if (!(card1...
  30. W

    Comp Sci Changing a double value to an integer value in c++

    Homework Statement I'm making a program which will convert mph to minutes and seconds per mile. For example my program will take 6.5 mph and convert it to 9 minutes and 13.8 seconds per mile. But being new to programming I don't know how to convert a double value to an int value (I believe its...
  31. W

    Comp Sci Allowing the user to re run a program in c++

    Homework Statement I am making mini programs where there some calculations going on and when all that is done my program is to ask the user if he wants to repeat the calculations or not. If he does then the program is to restart and if he doesn't then he can close the window by pressing the...
  32. A

    C/C++ Two Body problem with RK4 in C++

    I want to output an excel file with the results of the trajectories of a two body problem, with initial position and velocity. But my program is not compiling. Any suggestions/problems that you can see? #include <iostream> #include <vector> #include <fstream> using namespace std...
  33. M

    C/C++ Jumping straight into C++ without programming knowledge

    Hello, I was looking at an Introduction to C++ class I might be taking next semester Description: This course is an introduction to the basic principles of programming using C++ as the development tool. Topics include the structure and design of algorithms, input/output, branching...
  34. C

    Comp Sci Axial Turbocharger Modelling in C++

    Hi, currently i am studying the performance of axial turbocharger, and i have formulate the equation and all the data in Microsoft excel, and i want it to be convert into C++ language, could anyone teach me how to start by doing this, because i am totally new in C++...please...i already upload...
  35. W

    Comp Sci Calculating Distance in C++: Troubleshooting Exponent Error

    Homework Statement can some one tell me what I am doing wrong in this program. I am getting a error C2296: '^' : illegal, left operand has type 'double' error at line 10 where I do my distance calculations. I am using Microsoft Visual Studios 2008. Homework Equations The program...
  36. Biosyn

    Comp Sci How to Use a While Loop with Arrays in C++?

    Homework Statement Homework Equations The Attempt at a Solution #include <iostream> #include <cstdlib> using namespace std; using std::cout; int main() { int sum=0; int Array[] = {1,2,3,4,42,5,6}; // int Array[] = {42,1,2,3}; // int Array[] = {12,-10,42,10}; // int...
  37. P

    C/C++ Microsoft Visual Studio C++ error

    Hello, I'm new to Microsoft Visual Studio and new to the C++ program. I just installed the program and I'm trying to write my first program. First error that I get is: ========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ========== Why is my project out-of-date? Second...
  38. Biosyn

    Comp Sci Master For Loops and If Statements with C++ Homework Help | GetCode.me

    Homework Statement Hello, the problem is in this video. It is displayed near the end starting from 6:19 onward. It's titled "Extra Credit" Homework Equations For Loops and If Statements? The Attempt at a Solution Here is my attempt at the problem: http://www.getcode.me/3sr0mzy7rz1cgrfu
  39. Z

    C++ or verilog or random process ?

    C++ or verilog or random process ?? I'm currently in 3rd year of my undergrad in Electronics & Communication engg. For my 6th semester, I'm required to take 1 elective from the following- -Data Structures with C++ -Random Process -Digital System Design using Verilog -Analog & Mixed mode VLSI...
  40. C

    C/C++ C++ modelling of axial turbocharger

    HI, i am a student taking final year project in my university, my project title was C++ modelling of axial turbocharger, it was a counter-rotating turbocharger, can anyone help me to get some useful information to complete my project? thanks
  41. U

    C/C++ Why is C++ so much harder than Java?

    I'm into my second year now at uni and after learning Java for the past year, the course is now introducing us to C++. We're still doing java but now C++ aswell. I don't know if I'm the only one but C++ is sooooo much harder than java, today after just our second lesson we're being introduced...
  42. A

    Help! C++ Struggles: My First Programming Class

    I am taking C++ this semester, and am not really good at it. It is my first programming class, and I kind of stink, though I am trying. I don't think I'm going to get a great grade, and it will bring down my average. I was thinking of dropping it, but then had a look at the class averages...most...
  43. N

    Comp Sci Find primes using sieve of erasthothenes by way of bit arrays in C++

    Hey. I have to create a program in C++ to calculate the number of prime numbers up to a specified number. I also have to print out the first and last 5, but I'll cross that bridge when I come to it. I can do this fine with integers, but we have to do it where each slot in an array represents...
  44. N

    Comp Sci Finding circle zero-points with C++

    Hi everyone! My primary question is below the problem. My problem: Circles The standard form of an equation for a circle is (x − h)2 + (y − k)2 = r2 where (h,k) represents the center of the circle and r is the radius. The y-value of the equation becomes zero at the point of intersection with...
  45. O

    C/C++ How to make my program switch commands at certain intervals/bounds in c++

    I have a new problem where I have 2 formulas, and I need to tell my program that at certain intervals/parameters/bounds it needs to do one of the formulas and at other intervals it needs to do another one. To be more descriptive When ever my time=0 to time=(T/2) it should do formula 1, and...
  46. O

    C/C++ How to Solve Bisection C++ Problem for Calculating Volume

    #include <iostream> #include <cstdlib> #include <cmath> using std::cout; using std::endl; using std::cin; int main() { double h,v,w,z,y; cout << "Enter the width, W: "; cin >> w; if (w<0) { cout << "Error: The Width must be strictly positive." << endl; return EXIT_FAILURE; }...
  47. S

    Comp Sci Solve Basic C++ Coding Challenges with Easy Steps

    Basic C++ Coding? Assume that name and age have been declared suitably for storing names (like "Abdullah", "Alexandra" and "Zoe") and ages respectively. Write some code that reads in a name and an age and then prints the message "The age of NAME is AGE." where NAME and AGE are replaced by the...
  48. S

    Comp Sci Understanding Newton's Method in C++

    Homework Statement why the loop not looping ? Homework Equations fun1=x^3+4^2-x-1 fun2=3x^2+8x-1 The Attempt at a Solution #include "stdafx.h" #include<iostream> using namespace std; float fun1(float); float fun2(float); void main() { float a; cin>>a; if (fun2(a)>0)...
  49. S

    Comp Sci Bisection Method for Finding Roots of x^3+4x^2-x-1 in C++

    Homework Statement find the roots ( interval halving ) , I want to know how to make a condition statement that when fun3 be less than 0.001 and then loop will stop and i get the root .(here in my code i don't know why the loop doesn't work as it should .. Homework Equations the...
  50. E

    C/C++ Storing Data From C++ Program to a file.

    I am using a verlet algorithm in c++ to model the motion of a satellite, and want to output position and velocity data from each timestep so that I can then read it into MATLAB and plot graphs to see how well my model matches the 'real life' graphs. so far I have at the end of each iteration...
Back
Top