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.
The use of 'const' in functions seems to be an endless source of confusion. Am I right in thinking that in this case:
double functionName(class const & parameter) {...}
the const specifies that the reference to the class being fed into the function may not be modified?
And that in this...
//******************************************************************
//Sherman Brown
//CIS 150-01 Programming in C/C++
//April 17, 2011
//Program #7
//Organizing data by age and gender, calculating average weight/height.
//*******************************************************************...
HELP! How to process multiple files in C++
I have been bashing my head against my desk in my cubical trying to figure this out. I have approximately 500 files I would like to read in, one at a time, into a C++ program, do my processing, and send the results to a new file. I can do the...
Hi,
I have to compute the optimal value of function of several variables. The function is maximized and/or minimized by nested variables x,y... For instance min(x) max(y) f(x,y).
The function is known and the variables take a values from a known finite domain. I have thought a solution where I...
It's a pity that the various coding standards that I have seen are inconsistent as to when to use #include "file_spec" or #include <file_spec>.
The "High Integrity C++ Coding Standard" says:
High Integrity CPP Rule 14.9: Use <> brackets for system and standard library headers. Use ""...
Homework Statement
I need to write a program (which passes by reference) to find the standard deviation of an array of numbers.
Homework Equations
http://en.wikipedia.org/wiki/Standard_deviation < the simple standard deviation formula is the one I am using.
I've tested the program...
c++ header files with and without "h" extension
hi fine people,:wink:
i have seen some people use header files with ".h" extension and some without it. what is reason? i think there are some header files where you are required to use ".h" such as "#include <windows.h>. you can not use...
hello everyone,:wink:
i was reading somewhere that there is C++ and C++ Standard. could some please tell me the main difference between two? and i also read something that some things such as "getch()" are non standard. can you guide me a bit on this? i will really appreciate this help of...
I'm learning c++ and currently trying to write a little programme for 1D linear convection (wave equation).
I have managed set all boundary and initial conditions as well as a mesh.
But I have reached the point where I can't understand why the program does what it does.
In red I...
hello nice people,
it was read by me that both ms windows and apple os has been made using basicaly c++. some days in past on a some antivirus article it came to my attention apple os is safe from virus than windows. if both use same kind of bricks they why bricks are easy to break in...
hello guys,
i have downloaded dev-c++ as suggested by some nice guys around here. from today i will start practcing with comuter programming. me know nothing about programing but sure will learn it with the help of this forum.
okay. i have opened new project named "gorilla" in dev-c++. it...
hello everyone,
this question is not directly connected with programming so forgive me for asking here. me and my friend have decided to take some c++ classes in a instituion. me have been there once. the guy who teaches (or tries hard at teaching or behaving like teacher) is very rude and...
I have seen the following in a abook:
"The argument(s) of a method can be any type of object (as long as its class has been made available to the program), as well as the predefined default types of variable. For example, methods in our three-vector class are not limited to just accepting...
Hi:
does anyone have a link for a C++ crib/reference sheet which includes everything. I'm having hard time with formatting the logic for some of my homework questions and I would like to have a quick reference sheet which explains the functions. I'm using the compiler CodeBlock 10.5 with...
Hello , i have the algorithm attached and i am trying to execute it in c++.
My code until now is : ( i have created the function f with limits (-1,1) )
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <cmath>
using namespace std;
const double...
hello every1,
i was able to find this book "Object-Oriented Programming in C++ (4th Edition) by Robert Lafore" in a local library. I am thinking of self-learning c++.. do u have any information on this text...is it easy...im totally blank in this area of programming and computers in...
hello,
someone has recommedned to me to use compiler turbo c++... is it any good? what is your take? programming thingy is totally new thing to me...i want to learn c++ though i have no prvious backgrond in this area. your help is much aprreciated. thanx
c++ simpson's method --loop doesn't stop
Hello, i have done the simpson's method and it works fine.My problem is that it doesn't stop when it gives me the desired result but the loop continues for ever..
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include...
Hey everyone, I'm trying to teach myself C++ and I recalled that a few years ago my Comp Sci major buddy of mine did a sudoku solving program as a project for a class so I decided to tackle it on my own. I'm getting some headway, but I'm having trouble figuring out a way to "brute force"...
hello,
would you kindly recommend me some simple C++ compiler programme to write not-very-complex DOS/text-based programmes? I'm new to C++, is one supposed to write pseudo-code into the compiler or instructions in terms some high level language? kindly let me know. thanks.
Hi, just wanted to know which version of FORTRAN is best to learn for one studying astrophysics...and whether C++ is of any importance in computational astrophysics...Thanks
I have a long C++ program that has a few simple statements in it. At the beginning I have ;
#define NUM_DP 10
Further on in the program I have this conditional statement;
short int ct, j;
.
.
.
ct = op2.test(op2.num);
if (ct < (NUM_DP - 1))
for (j = 1; j < 20...
Not a homework problem.
I've written a little compute-intensive code. That only keeps one core busy. So I run four copies. But compute time is variable so I thought I'd try my hand at multiprocessing.
I can fork to create four processes. No problem.
I/O is from cin, cout and the...
Ok I've been having a lot of trouble with this program, I am also very new to C++. The program requires to have 4 functions 1 main, 1 svr, 2 void functions
any kind of loop (for loop preferred) in the main function so that a user can enter any number of positive integers in the main function...
Here is the code that I have come up with. What could be implimented to make it compile and run? It runs, but all that comes up is the request for the integer between 1 and 3999, after I enter the number the program simply ends.
CODE:
#include <iostream>
using namespace std;
string...
I.e., what is beneficial about main(int argc,char *argv[])?
I see a lot of seemingly good programmers write the main like this, but what does it do that int main() cannot do?
Hi there. I've been trying to incorporate Proxies into a program I am currently making.
It's basically a c++ Chat bot that will load proxies from a list and connect from them into a chat, but I'm having a bit of trouble.
I've found a SOCKS 5 Wrapper, but I'm having trouble with that as...
Hello all,
I'll hopefully be attending a cognitive neuroscience PhD program next fall and I'd like to learn some programming beforehand (having programming skills helps for lots of neuroimaging labs) Labs I've worked in used UNIX and MATLAB and I'd really like to improve my knowledge before I...
Say for example
int a = 0;
if ( a ){
...
}
int a = 0;
if ( a < 0 ){
...
}
What's different with the first if statement? or do they have the same meaning?
Thanks
EDIT: What is the use of two-dimensional arrays? I see it mostly in file input output stream stuff.
And...
Hello,
I wrote a code for my problem but i can't find the mistake.It doesn't give me the right answer.
We must find the root using bisection method.
I found with mathematica that the solution is x= -3.18306.
The function values are x (-4,-3).
Any help is welcome!
#include...
Homework Statement
i have drawn a graph in C++/root which is a bunch of points (in an array) joined together ie it is not a function. it looks kind of like a gauss, but isn't ie its a peak. i want to find out the x distance between the points of 90% and 20% of the maximum. i am having...
I was writing a program to find if a given number is prime or not. I can't figure out what the error is.
/* To check if a number is prime*/
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
float a;
int p,i,f=0;
p=sqrt(a);
if(a %...
I'm trying to write a program in C++ that reads, writes, adds and substracts numbers entered as C-style strings. I have two questions. Is it necessary that the parameters of the + operator only be always objects of a class? Can an operator call another operator from within it, e.g.
my_float...
Homework Statement
Im having difficulty drawing a specific graph. I am not entirely sure how to explain my question/ the graph i need to draw so i think the best way is to provide a bit of my code and explain using it the graph using it...
the code below gives a read out of the energy...
can someone tell me what is wrong with my code. i get the graph that i want but not with the log scale... i have tried multiple methods. this is the last one i tried (its part of a canvas which is split into quadrants)
TH1F* h3 = (TH1F*) inputfile3 -> Get("pdg");
c->cd(3)...
For a function
using namespace std;
mst(const vector<list<pair<int,int> > > &adj_lists, int v){
// code before iterator
list<pair<int,int> >:: iterator it;
it = adj_list[0].begin();
// code after
}
I'm trying to set up an iterator to walk through the list contained within...
What is the result of..
int*double=? Is it double?
int+double=? is it double too?
And...
What is "%" in a calculation? And how to solve the a calculation using "%"?
Hi. I need help with in running my program, when I tried it in the computer lab, my program didn't run..And I'm sure it couldn't run because of my workings..which I assume are incorrect. I appreciate it if you could tell me where did I go wrong with my calculations and if it matched the...
Homework Statement
well, my assignment was to make a gauss elimination, so now i need to compute the determinant of an n by n diagonal matrix
variable rows = number of equations
variable i = random integer
matrix A[100][100]
dummy matrix A2[100][100]
Homework Equations
det[A]...
Homework Statement
We have multiple sections of a class for which we need to produce grading summaries by section. The grading summaries that we need are a count of how many students earned A’s, B’s, C's, etc., and the lowest, highest and average grade for each section. At the end of...
Hi,
I am new to programming, but I think this is a simple error. For my programming code I am trying to pass a variable from a certain class to another class. The code is similar to below.Class 1
#include "class2"
Class2 class
var1=1
var2=2
class.acceptingvariablesfrom1(var1 var2)...
Homework Statement
Dear physics forum,
I'm start learning C++ and I'm trying to program a space transform function for linearized convection-diffusion problem using Code:block
Everything was fine until I wrote calculated result into a file. When I run the program, some error message...
Hi there, I am a third (maybe second year for US standard?) year mathematical physics student and I have just realize that I do need obtain some programming knowledge.
My university has a compulsory courses that teaches java programming, but, looking around I've come to the conclusion that...
Homework Statement
#include <iostream>
using namespace std;
int main()
{
int firstNo;// first number is stored here
int secondNo,
int resultAdd,// variable for result when first number and second number are added
int resultSub,// variable for result when first number and second...
Homework Statement
!( ((count<10) || (x<y)) && (count >=0) )
where count is equal to 0Homework Equations
i don't think any equations here are necessary except maybe the precedence lawThe Attempt at a Solution
they combined 'and' and 'or' which confused the heck out of me. How do i figure out...
Hello again,
Im trying to build a neural network using C++. Has anyone had a go? I think the potential implications are really interesting and would like to hear about how people might have implemented them. Another general one for anyone.
Hi,
I am having an issue with multiplication in C++. I am writing a program to check the validity of an NHS number. To do this I must;
multiply digit 1 of the NHS number by 10,
multiply digit 2 of the NHS number by 9,
multiply digit 3 of the NHS number by 8 ...etc
The answer from each...
it prints fine for the first generation, but nothing else after that. i am thinking that my problem lies in the cellStatus function and its implementation within the printCell function. attached are the files that i am getting input from and the file that i am printing to.
#include...