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

    C/C++ C++ how to use getline -- Having issues with this program

    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 <iostream> #include <string> using namespace std; int main() { string userWord; int userNum = 0...
  2. M

    Learning c++ for math, CFD, etc.

    When I took such courses I suffered due to the fact that I could not code/program. My friends and professors knew how to make 1-D or 2-D grids for heat transfer problems, writing calculus formulas and differential equations in code. How can I learn this? I already know how to solve these...
  3. C

    C/C++ Normalize Array w/ C++ & Max of 60 x's

    I need to normalize an array, I find the max value which can be any integer. I have to output this number using cout and represent it as 'x' how ever many times. The catch is I can only have a max amount of 60 x's. If my max is 500 I need to display it as 60 'x' and normalize my whole array to...
  4. FallArk

    C/C++ Solve C++ Vector Question: #include, for Loop, getline(), vector.pop_back()

    I ran into some trouble with a C++ question. I need to make a program that will run like this: Example run 1: How many names do you want (max 99)? 5 Enter name #1: Adam Apple Enter name #2: Betty Boop Enter name #3: Charles Chaplin Enter name #4: Debbie Dali Enter name #5: Elaine Eggbert What...
  5. A

    Comp Sci Understanding C++ Constructors | Homework Question

    1. Homework Statement In the third constructor in the second snippet of code, I keep getting a compiler warning that hours, milli, seconds, and hours is not initialized in the constructor. Should I just set them equal to zero within that constructor? I have never worked with multiple...
  6. FallArk

    C/C++ What does the modulus operator mean in a C++ if statement?

    I have run into an if statement as shown below: if (randoms[(x * 3) + y] % 2) I don't really understand what this means. Thank you for helping!
  7. A

    Comp Sci C++ Error Checking (Simple program)

    Homework Statement I am writing a program that will calculate the average and standard deviation given data by the user. The data is entered into a vector. The size of the vector is also determined by the user. When the user enters the size of their vector, they need to enter a positive...
  8. M

    C/C++ Intro to c++ help with vector problem

    So I'm trying to do this problem: Write a for loop to populate vector userGuesses with NUM_GUESSES integers. Read integers using cin. Ex: If NUM_GUESSES is 3 and user enters 9 5 2, then userGuesses is {9, 5, 2}. Here is my code so far... #include <iostream> #include <vector> using namespace...
  9. N

    C/C++ C++ - Determining If A String Contains Any Numeric Digits

    Set hasDigit to true if the 3-character passCode contains a digit. #include <iostream> #include <string> #include <cctype> using namespace std; int main() { bool hasDigit = false; string passCode; int valid = 0; passCode = "abc"; if (hasDigit) { cout << "Has a digit." << endl; }...
  10. M

    C/C++ C++ Programming: Intro to Analyzing URLs w/ Built-in Library

    I'm in an introductory course for c++ and I'm trying to make a program where it analyzes a url link and do string searches within it. For example if I were to put in https://www.wikipedia.com , it would say, "You've requested the Wikipedia- The Free Encyclopedia page." My professor told us...
  11. chaiein

    How to create a pose graph from the image descriptor?

    what are the different kinds of input can be given to make a pose graph?
  12. FallArk

    C/C++ Get Help with C++ Homework: Solving Problems with User Input

    I ran into some problems when trying to finish my assignment. The objective of this assignment is to create a block of code that will keep asking the user to input numbers until the input is 0. And if the user input 0 for the first value it will say "No data submitted!". I got all those parts...
  13. RJLiberator

    Comp Sci Problem with my C++ code (MATH/Physics based)

    Homework Statement Here's my problem. I am working with ROOT which uses C++ and I am making 3 different graphs. This particular part of the code is for the parabolic motion with density calculation. The problem is, that I follow the rules in the powerpoint provided to me, the other two of my...
  14. RJLiberator

    Comp Sci Solve C++ & ROOT Problems: 3 Questions Answered

    I have three problems that I've been trying to tackle for a while now. 1) I have a code for the bisection method. I would like to use TLine *line = new TLine function to create the lines that you normally see in the bisection method. These lines from a to F(a) are the ones I am talking...
  15. RJLiberator

    Comp Sci C++ Free Fall Velocity Homework

    Homework Statement I'm using ROOT (c++) to graph a numerical representation of the equation of motion. For simplicity, I am using initial velocity = 10 and initial height = 10. change in time = 0.05 so we find velocity by V_n = V_(n-1) -9.81*0.05 For some reason, this code is not giving me a...
  16. C

    C/C++ Why Isn't My C++ Function Passing By Reference Correctly?

    Define a function CoordTransform() that transforms its first two input parameters xVal and yVal into two output parameters xValNew and yValNew. The function returns void. The transformation is new = (old + 1) * 2. Ex: If xVal = 3 and yVal = 4, then xValNew is 8 and yValNew is 10. My code...
  17. iamjon.smith

    Comp Sci C++ search algorithm with 3 sublists

    Homework Statement This is the assignment instructions:[/B] In C++, code a search algorithm that searches a list of strings for a particular song. The searching algorithm will have two inputs: the playlist, which is a string array that contains a list of songs in alphabetical order; and a...
  18. RJLiberator

    Comp Sci C++ (ROOT) Form a matrix and send it to a 2d Histogram

    Homework Statement [/B] 1. I've been tasked with forming a 10 x 10 matrix with elements 0, 1, 2, 3, 4, 5,... and have it display properly. 2. Then, take this matrix and make a 2d-histogram out of it. Homework Equations Here is my code void matrix6( const int n = 10) { float I[n][n]; //...
  19. S

    Learn C Programming Language: Tips & Resources

    Hi all, I am looking to learn C by myself since it is a programming language that is used in my micro controllers class that i am going to take during the upcoming Spring semester at my university. I was wondering how i should go about doing this? I was thinking of using book The C Programming...
  20. T

    C/C++ Rewriting C/ C++ code in Pascal

    Hello, I have a code in C/ C++and I have just learned I am going to need it in a version compatible with Free Pascal. I would never bother anyone with it but as I need it pretty quickly and my knowledge of Pascal is very poor I would spend ages rewriting this and it probably woudn't even work at...
  21. Svein

    C/C++ Do Real Programmers Still Exist?

    Copied from Datamation, July 1983 Real Programmers Don't Use PASCAL More: http://www.ee.ryerson.ca/~elf/hack/realmen.html
  22. C

    Comp Sci Need Help with C++ RLE Algorithm Homework | Troubleshooting Encoder Function

    Homework Statement [/B] See this link for the given assignment. http://eilat.sci.brooklyn.cuny.edu/cis1_5/HW5i_C.pdf note: on the last page the output aa4bcdd0cc1 is actually supposed to be aa3bcdd1cc1c. Homework Equations I have no idea why my encoder function doesn't work. No matter how...
  23. R

    Comp Sci C++ Why the loop going in infinite loop?

    Homework Statement I have to find GCD or HCF of two numbers. Homework EquationsThe Attempt at a Solution #include<iostream.h> #include<conio.h> void main() { clrscr(); int i,m,n,temp; cout<<"Enter two numbers\n"; cin>>m>>n; do { if(n>m) { temp=n; n=m...
  24. R

    Comp Sci C++ Sum of prime numbers in matrix

    Homework Statement My Program is not showing the sum value or not returning it. A blank space is coming.Why that is so? Homework Equations Showing the attempt below in form of code. The Attempt at a Solution #include<iostream.h> #include<conio.h> Prime_Sum(int arr[30][30],int m, int n); void...
  25. S

    C/C++ How can I overload the + operator in C++ for a family vacation program?

    Hi, I'm having difficulty with this program in a textbook. The instructions are as follows: Overload the + operator as indicated. Sample output for the given program: First vacation: Days: 7, People: 3 Second vacation: Days: 12, People: 3 This is the code that follows #include <iostream>...
  26. D

    C/C++ How to break a string into left and right characters for Feistel cipher in C++?

    Your program will ask the user for a text string to encrypt and a key (key). You will loop through the string setting left to the first character and right to the second, and encrypt this with 3 Feistel rounds, and output the text as hexidecimal. Continue to loop through the string using the 3rd...
  27. R

    C/C++ C++ prog. to reverse each word in sentence

    #include<iostream.h> #include<conio.h> #include<stdio.h> #include<string.h> void main(){ clrscr(); char a[10],b[40]; cout<<"Enter sentence\n"; gets(a); cout<<a ;\\ How to reverse here? getch();} I don't know the proper code how to do the program of reversing each word in a sentence. How does...
  28. C

    C/C++ Create a C++ logic calculator (T/F) using a recursive descent parser

    I'm supposed to make a simple logic calculator based on the following requirements: 1. The user can use either capital or lower case 'T' and 'F' in their expression. 2. Use either a ';' or '=' to indicate the expression should be evaluated immediately. 3. The program should not exit when it...
  29. C

    C/C++ C++ Online Store Program (Private vs Public data)

    Write a C++ program based on the following scenario: You customer wants you to design and then build an online store: Abilities the customer wants in the system: Track products and related information. Track customers, especially what the customer owes Identify a product that will be for...
  30. B3NR4Y

    Comp Sci Store values in an arbitrarily sized matrix C++

    Homework Statement "Calculate the max, min, count, average, and standard deviation (std dev) of a set of numbers. The formula for average is: average is sum divided by count The formula for standard deviation is stddev is the square root of the variance The formula for variance is variance is...
  31. C

    C/C++ C++ Spell Checker: Abbreviation Decoding & Tweet Suggestions

    1) Create a few tweet abbreviations that can be decoded. Add support for abbreviations. 2) For abbreviations that do not match the supported abbreviations, check for common misspellings. Provide a suggestion for correct abbreviation along with the decoded meaning. For example, if the user...
  32. C

    C/C++ C++ Dice rolls: Counting number of rolls that equals six or seven. ()

    1) Calculates the number of times the sum of the randomly rolled dice equals each possible value from 2 to 12. 2) Repeatedly asks the user for the number of times to roll the dice, quitting only when the user-entered number is less than 1. Hint: Use a while loop that will execute as long as...
  33. C

    C/C++ How do I compute N factorial in C++?

    Write a program that let's a user enter N and that outputs N! (meaning N*(N-1)*(N-2)*...*2*1). Hint: Initialize a variable totalValue to N, and use a loop variable i that counts from N-1 down to 1. #include <iostream> using namespace std; int main() { int totalVal = 0; int userInt = 0...
  34. C

    C/C++ C++ Coding question (How do I do it?)

    The following incomplete program should compute a student's total course percentage based on scores on three items of different weights (%s): 20% Homeworks (out of 80 points) 30% Midterm exam (out of 40 points) 50% Final exam (out of 70 points) Suggested (incremental) steps to finish the...
  35. R

    C/C++ Printing Integer Digits as Words in C++

    Write a “C++” program to read any integer number and print each digit into word. I went like this # include <iostream.h> #include <conio.h> void main(){ int a,b,c,d; clrscr(); b=a cout<<"Enter any number"<<endl; cin>>a; c=a%10; d=a/10; I am not getting further logic. someone was saying for loop...
  36. Thor90

    Finding eigenvalues with QR method

    Hi, I am trying to solve the problem of finding eigenvalus for a general square symmetric matrix with the QR algorithm. I have understood that this task is much easier if the matrix is in an Hessemberg form, so I have implemented a function that does that with the Housholder method, but I can't...
  37. R

    C/C++ C++ Variable Transfer Help - Ask for Advice

    I am just getting into C++ and I would like to ask you guys for some help regarding transferring variables form one function to another. Is there any way I can declare a variable such that it can be referenced and changed throughout all the programs functions? Thanks.
  38. waver.

    C/C++ Why is my insertion sort code not working for certain array sizes?

    hi Guys i wrote a insertion sort code which is #include <iostream> /*Waver*/ using namespace std; int main() { int n,i,m; float a[100],k; cout<<"enter the amount of number"; cin>>n; for(i=0; i<n; i++) cin>>a[i]; for(i=1; i<=n; i++) { for(m=1 ; m<=i; m++) { if(a[m]<a[m-1])...
  39. Domenico94

    C/C++ C++ vs C Debugging: How Hard Is It?

    How hard is c++ debugging compared to c? What do you think o f the sentence: "It s easier to shoot your foot in c. In c++ it s harder, but when you do, you blow away your whole leg"? Is it really hard( considering the fact code isn t "context free" and it may vary from compiler to compiler, it s...
  40. MathematicalPhysicist

    C/C++ A programme that doesn't get compiled in C++

    I have the following code for operations on polynomials in C++, I get plenty of errors which I want to rectify, here's the code: #include<stdio.h> #include<math.h> template<class T> class list{ protected: int number; T** item; public: list(int n=0):number(n), item(n ? new T*[n]:0){ } //...
  41. Domenico94

    Learning Java and C++ for Job Opportunities

    Hi everyone... I'm a communication system engineering student and in my university we use studying Java. Now, for this summer, when I ll have free time, I was thinking about doing some practice with programming and maybe studying a new language, such C++( it s still a widesprrad language and I...
  42. B

    Other Seeking a Recommendation for C++ Book

    Dear Physics Forum advisers, I am trying to learn the C++ programming language as I need it for my upcoming research in the theoretical computing and cryptography. This is my first time learning the programming language so I am seeking two books (I prefer to learn from the books than using...
  43. E

    Did I waste time getting an MS in computational physics?

    I completed the first year of grad school in physics and then contemplated returning to get the master's or just drop out. I had some prior experience using C++ and C# and was getting interviews for C# developer roles, but could not pass technical interviews since I failed questions on data...
  44. Angelos K

    Cannot use simplest ifstream with LAPACK

    I have an official LAPACK example from here: https://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mkl_lapack_examples/dsyev_ex.c.htm It compiles and runs without errors or warnings after using ludi@ludi-M17xR4:~/Desktop/tests$ gcc -Ddsyev=dsyev_ -o sylapack sylapack.c...
  45. ChrisVer

    C/C++ Infinite loop problem C++ for char instead of int

    I need some help in optimizing a code with a prompt yes/no...My problem is that if I mistype within the loop for r some character (let's say I'm missing the number 8 on the keyboard for u) the program gets into an infinite loop. Do you know some way that I could solve this problem? Like printing...
  46. Saitama

    C/C++ How can I optimize my C++ code for a sum problem on CodeChef?

    I am trying this problem on CodeChef: Just a simple sum My task is to evaluate: $$\sum_{i=1}^n i^i \pmod m$$ Following is the code I have written: #include <iostream> using namespace std; typedef long long ll; ll modularPower(ll base, ll exponent, ll M) { ll res = 1; while...
  47. M

    How to Output an Image from a Fractal Program in Emacs?

    Alright, so I programmed a fractal in emacs and used the terminal on my mac to compile it and it compiles and everything but it outputs the coordinates. I want to output a image from my fractal program so could you guys help me out with that? Any advice would be awesome
Back
Top