2015.09.08 C + + notes

Source: Internet
Author: User

#include <iostream>#include<string>using namespacestd;int*F1 (int*i) {    ++(*i); returni;}int*F2 (int*i) {    returni;}voidF3 (int*i,int*j) {cout<< *i <<" "<< *j <<Endl;}intMainvoid){    //04.sizeof again    intc[Ten];int*u =C; cout<<sizeof(u) <<" "<<sizeof(*u) <<" "<<sizeof(c) <<" "<<sizeof(*c) <<Endl; //The result is:4 4 4//03. Order of Evaluation    intK =0, j =0; F3 (F2 (&AMP;J), F1 (&j));//output in either order: 1 1     while(K < +) cout<<++k<<" "<<k<<endl;//output in either order: 1 1//01. Read one line of characters, convert the first letter of each word to uppercase, use an iterator to implement    strings; inti =0;    Getline (CIN, s);  for(Auto B = s.begin (); B!=s.end (); b++)    {        if(Isspace (*b)) I=0; Else if(i = =0)        {            *b = ToUpper (*b); I=1; }        Elsei =1; } cout<<"\ n"<<s<<Endl; //02. Initialize each element in the array to its own ordinal, size_t = unsinged int    Const intC1 =3, C2 =4; intA[C1][C2];  for(i =0; i<c1; i++ )    {         for(intj =0; j<c2; J + +) {A[i][j]= I*c2 +J; cout<<a[i][j]<<' '; } cout<<Endl; } getchar ();} 

#include <iostream>
#include <string>
using namespace Std;


int *f1 (int *i)
{
+ + (*i);
return i;
}

int *f2 (int *i)
{
return i;
}

void F3 (int *i, int *j)
{
cout << *i << << *j <<endl;
}

int main (void)
{
04.sizeof again
int c[10]; int *u = c;
Cout<<sizeof (U) << "<<sizeof (*u) <<" "<<sizeof (c) <<" "<<sizeof (*C) < <endl;
The result is:4 4 40 4

03. Order of Evaluation
int k =0, j = 0;
F3 (F2 (&j), F1 (&j)); Output in either order: 1 1
while (K < 21)
cout <<++k<< "" <<k<<endl; Output in either order: 1 1

01. Read one line of characters, convert the first letter of each word to uppercase, use an iterator to implement
string S;
int i = 0;
Getline (CIN, s);
for (Auto B = s.begin (); B!=s.end (); b++)
{
if (Isspace (*b))
i = 0;
else if (i = = 0)
{
*b = ToUpper (*b);
i = 1;
}
else i = 1;
}
cout<< "\ n" <<s<<endl;

02. Initialize each element in the array to its own ordinal, size_t = unsinged int
const INT C1 = 3, c2 = 4;
int A[C1][C2];
for (i = 0; i<c1; i++)
{
for (int j = 0; j<c2; j + +)
{
A[I][J] = i*c2 + j;
cout<<a[i][j]<< ";
}
cout<<endl;
}

GetChar ();

}

2015.09.08 C + + notes

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.