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.
I'm trying to come up with a C++ program that reads input from a text file. Each line of this text file has a different variable. I have different data types (int, string, char). I'm having difficulty to read strings with spaces and read char's. The rest seems to work fine. If possible, I'd like...
If I take a six digit number and store it in one variable, how can I place spaces between each digit at the output. This would be so much easier if each digit were stored in separate variables.
--thanks
Just curious if there was any difference between the following two set-variable style functions for member variables interms of effiecieny
CType& Member(void) {return _member; } //Used in David Eberly's Code
void Member(CType const& tp) {_member=tp); }
Is there an actual difference?
Also...
I'm just finishing off my C++ project and I decided when looking at two functions that they would be far more efficent as one function (because they are always used together and as it was it repeats the same code twice).
Now I wanted my output as an array so I could called on the two needed...
Hi,
Has anyone here used the complex C++ class before Header <complex>? I am trying to do something VERY straightforward but there doesn't seem to be any way to do it!
Basically, I define a complex, and then want to re-asign its real and imaginary parts:
complex<double> A(1,1); //...
I know I am not a moron but this C++ is killing me, I have to write a program using functions to convert temp between c, f, k I am hung up
// Mod4project2tempconvert.cpp : Defines the entry point for the console application.
#include <iostream>
using namespace std;
double ftemp (double...
I have to answer a homework problem due today that I am not sure how to do the problem reads.
"Write a program that calls a void type function to find the maximum of three given integer numbers"
We use visual studio.net, any help would be appreciated and I would like to be able to compile it...
Just been introduced to the world of C++ as I'm taking a course on it in my maths degree. We are asked to write a simple program that takes in 3 numbers, sorts them in terms of order and then outputs them.
Not going to type my full program as that would probably be a waste of your time but...
umm, anyone who could help me write a code wherein, given an input file, it searches for a word inputed by the user, then outputs the result (how many times it appeared in the input file) in an output file. This program also uses 2 command line arguments. The first argument is the word to search...
Umm guys, is visual c++ a very different programming language than c++. I mean, I installed a copy of visual c++ and looked at the pre-made template of hello world but saw that it is very different from the normal source code for c++.
I have this code made from devcpp, the calculator if you...
i have this problem and i am having trouble how to incorporate another function into this problem here is the problem..
#include <iostream>
using namespace std;
struct node {
int data;
node *next;
};
struct node *push_front ( node *list, int data )
{
node *p = new node...
Hello guys. I'm trying to do the command "PLEASE PRESS ENTER KEY TO RETURN TO MAIN MENU."
The problem is that I don't know how to catch this enter key. I do know that its ascii value is 13. I tried using sscanf and getch but can't seem to make it work.
void StockBroker::showAllBalances()...
I want to start learning python. Lots of people I know say it's a very good language. Right now I know Java and a little bit of C++, but I'd like to experiment with some other languages, specifically Python. Right now I've got Python 2.4 installed on my PC, now I need to know what to do from...
I want to know how I can get my program to respond to commands in C++. for instance, when someone presses the up, down, or side arrows; or when somebody clicks something.
I want to learn another language besides C++. What would you reccomend? I was thinking BASIC, but I'm not too sure. What do you think would be good next?
What's wrong with this C++ project I'm working on? it's supposed to find the area of a circle:
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int pi = 3.14
int rad
int radsqr = rad*rad
cout << "radius of the circle:"...
Umm guys, can you give me some ideas of what ptogram to create using basic c++? I've already learned arrays, pointers, classes, strings, etc. I really like to make a game but don't know what game to create.
Actually, i had the idea to make a hack/cheat for microsoft's spider solitair wherein...
Guys, I'm starting to learn c++ and wanted to know hot to implement various operations using only + and -.
I'm trying to implement *, /, %, powers, and square root.
I've been experimenting with the for loop but can't seem to make it work. Any tips on how to do these?
Thanks :D
for example
user puts in the month as 1-12
the day for whatever month
and the year, which has to include leapyears
leap years only occur when the year is divisible by 4 y%4==o or if divisible by 400 but NOT 100, so 2000 is a leap year but not 2100
so if somebody puts in month 1 day 1 and...
hi,
i have a little problem i m not able to check if an input character is in a specified range of characters. i.e is this char between A and Z let s say.
I tried to use the ascII but it didn t work out; no syntax errors at compile time but the error occurs at run time.
this is the code i...
I'm having troube getting my program to display a parallelogram. The source code here just displays a triangle with "6" as the speicifed size.
*
**
***
****
*****
******
*****
****
***
**
*
The output is suppose to be something like this:
_____*
_____**
_____***
_____****...
for anyone who owns or is familliar with 'visual C++ 2005 Express Edition beta 2' .
I'm new to programming, and I don't understand how to compile. probably a stupid question, but can anyone tell me how?
Sup,
is there a purpose to declaring functions as FRIEND rather than as member functions of a class...types of functions I'm looking towards: Print Save Load.
I'm trying to organize my code(3D engine/neural nets) and I'm looking to put those above 3 functions in a separate namespace or as...
I have started my course of C++ basics for a few weeks, some of my friends introduce Deitel's books, can you help give some comments on his series so I can assume myself that his are good enough not to waste my money on.
It looks like a dictionary to me, and well, I don't have much money...
i have to create a program to separate ANY number of integers into odds and evens and give back the sums of them seperately
i'm thinking to use if i%2=0 then it is even
or if i%2 is .5 then it is odd or sumthing
i haven't learned much about how...
How do you create an exe file in visual c++? I was unable to find any relavent information in the help files. I'm looking to save my program as an exe so that it can be ran on any computer by simply opening the exe file.
I am getting an error I cannot seem to figure out. whenever I try to compile it, it says c is undeclared. I want to check a type char variable against letters of the alphabet in an if function. Maybe someone could explain what I am doing wrong.
#include <iostream>
#include <cctype>...
if this is in the wrong forum i truly apologize but this is an engineering question and who better to answer but engineers, i have dificulty getting problems started in C++, i just don't know how to get a problem started, writing the rest of the program is easy but i can't diagnose it properly...
I am learning how to use the for loop to find out the total of:
1/30 + 2/29 + 3/28 + ... + 29/2 + 30/1
and i wrote the following. but it doesn't work and give the correct total.
can you guys tell me what's wrong?
Thanks
#include <iostream>
using namespace std;
int main ()
{
int num...
Hi, I've been having trouble erasing elements from a <vector> (that is from the STL of C++)
See I declared 2 vectors V and S, V contains let's say all the elements, while S is a solution set which contains some elements that are classified... well yeah...
I need to create V-S which is a...
I'm working on learning how to create classes in C++ and I'm still a little unclear on the syntax for constructor functions and access member functions.
We've been using this class called "rational" for working with rational numbers. Header and implementation files are here...
Ugh! I'm working on my last homework assignment and I can't seem to even get off the ground. :cry:
The teacher created a class for rational numbers, and now we are working on some functions for a polynomial class which uses arrays of rationals from his class. My polynomials are arrays of...
Im having difficulty computing large Hermitian polynomials in C++. I fear I may have to steer away from a recursive formula. Any help would be greatly appreciated.
John
Who can tell me how I can calculate numbers to as many digits as I see fit? The normal libraries can only hold 19 or so, which is waaayyy less than I want. Any help is appreciated.
Jameson
Hi,
I am playing around with doing stuff recursively, just to practice, and I have a problem I can't work out. I want to write a recursive function that will sum the digits of a number, take the result, sum those digits, etc. until I reach a single digit number. Then I want to return that...
I'm writing a Steque class that will inherit from my Stack and Queue classes. When I try to link it, I'm getting this weird error, which I'm sure has something to do with trying to inheritance.
Queue.h
#include <iostream>
#include <cstddef>
#include <stdlib.h>
using namespace std...
I am working on a project, I am attaching my code and the Solutions...im not sure wat is wrong w/ the code, but i couldn't get it to ask for "Inputting a value for a" at all...i was able to get it to input theta1 and theta2 though. Plz help me out ASAP...I want to attach my assignment pages...
OK, so I've got this wacky homework assignment that involves reading stuff out of a .mp3 file. Just to get started, I am attempting to read the first four "bytes" of the file and put them into an (unsigned char) array. I am not really sure if I am reading from the file or not - I can't tell from...
Hi,
I just began working on a little program to convert base 10 number to Roman numerals. I couldn't figure out how to make a loop to count how many Ms, Ds, Cs etc. so I wrote it out the long way for now.
I can see a lot a repetition and an obvious pattern in my divisors, since I am dividing...
I am working on a little piece of a program that prints two diagonal lines. I am using a variable "num" to specify how far down to draw each diagonal.
What I would like to do is be able to start at a position on the screen
and have the printing begin at that position, and also track the...
Loading a File in C
Ok here is my code:
FILE *fReadOpen( void )
/*
purpose: open file for reading
goal state: fReadOpen returns pointer to file
*/
{ /* begin fReadOp */
/* data object declarations */
char FileName[80]; /* input file name */
FILE *pInFile; /*...
Hopefully this sort of questions will soon be answered in the tutorial (good effort, Dduardo!), but for the time being, this one is not.
I have the following scheme:
class Foo {
...
protected:
struct PartOne {
...
};
struct PartTwo {
...
PartOne* someFunction ();
};}...
In trying to learn C++ (I'm an old FORTRAN guy), I am unable to figure out how to define and initialize a complex array. Single complex numbers are straight forward, but going further has me perplexed some.
Thanks in advance.
I know Visual Basic and Java now, but I think it's time I learn C/C++.
Do I need to learn just C++ or is C worthwhile too? [yes, I know they are similiar...]
1) Books/Tutorials?
2) Is there a discount [student...] for acquiring the software with?
If you're familiar with both Java and...
I have the following problem: My program is supposed to read data from files to an array. The files are numbered: file1.dat, file2.dat and so on. There are 24 of those files, and I really don't want to do the same step 24 times. Is there a way to write a loop along the lines of
for (int...