MacroOur calculator program, with 1234 corresponding to subtraction, is a bit of a hindrance to people reading. After one months to look at this code may not be able to think of 0123 or 1234, but also to find in the code, if you can represent the
If your code works properly and behaves well, you might wonder why you're using C + + 11. Of course, it feels good to use the latest technology, but is it actually worth it? In my opinion, the answer is no doubt yes. I've given 9 reasons below,
ArrayYou can store a variable of one or more sets of values, which contains multiple elements, and each member of the array is an array element.One-dimensional arraysDefinition: type array name [constant expression] = {value 1, value 2, value 3 ...};
In fact, similar to the "Statistics of occurrence" problem has been encountered in many places, for example, statistics of a set of numbers, the number of occurrences of each number. Most of this kind of statistic will move in one direction, that is
1: Array Selection#include using namespace std; int main () { int a[10],b[10],i,j,m=0,n=0; bool num; cout>a[i]; for (i=0;i2: String#include #include using namespace std; int main () {
One. Array separation#include using namespace std; int main () {int a[10],b[10],c[10],i,j=0,k=0;cout>a[i];if (a [i]%2==0) {c[j]=a[i];j++;} else{b[k]=a[i];k++;}} coutTwo. String#include #include using namespace std; int main () {
One, array selection#include using namespace std; int main () { cout>a[i];for (i =0;iIi. summation#include int main () { cout>a[i];if (a[i]>0) sum1=sum1+a[i];if (a[i]Three, string#include #include using namespace std;
Intersection, difference set, and set of C # arraysThis knowledge is often used in the work to check those fields that must be entered, and those that are forbidden to enter.1 usingSystem;2 usingSystem.Collections.Generic;3 usingSystem.Linq;4
The reference reference is sometimes referred to as Alias aliases, as shown in the following example:int m=0;int &n=m;N=1;coutcout& means that n is a reference to M, that is, an alias, and any action on N is an operation on M.So n is neither a copy
Finally read through the C + + Primer Plus.The IO section skips, from start to finish 4.29-5.11 Just 14 days, the actual time spent reading is 6.5 days. If there is no 5.1 vacation, it should be a little better.But this is like reading, test several
Using system;using system.collections.generic;using system.linq;using system.text;using System.Threading.Tasks; Namespace self-hold {class program {static void Main (string[] args) {long faciend, num, mod, n_ MoD, P_mod;//mod is the coefficient of
I recently received a job assignment, which is roughly a generic data interface for business people to call and return all the fields in the foreground and the description of the units corresponding to the fields.Thus, I define a struct:public class
/// ///Print Triangles/// Public voidSanjiao () {Console.Write ("Please enter the number of lines:"); intA =int. Parse (Console.ReadLine ()); for(inti =1; I ) { for(intj =1; J ) {Console.Write ("@");
Application and user settingsSteps to create a new setting at design timeIn the Solution Explorer (Solution Explorer), expand the Properties node for the project.In Solution Explorer (Solution Explorer), double-click the. settings file in which you
HTTPS://MSDN.MICROSOFT.COM/ZH-CN/LIBRARY/Z883W3DC (v=vs.80). aspxThe order of the elements in the collection is preserved in the list .If the new count (the current count plus the size of the collection) is greater than capacity, the capacity of the
X-Plane flight simulation resource sorting 1, x-plane flight simulation
I plan to open a blog to sort out the secondary development of the flight simulation software.
It is expected to introduce three mainstream Flight simulators, X-Plane, Microsoft
Issues related to the initialization list of c ++ class members
In the following four cases, you must use the member initialization list to smoothly compile the program ):
1. initialize a reference member );
2. initialize a constant object (const
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service