#include <iostream>
using namespace std;
int main (void)
{
const int dasize = 3;
double darray2d[dasize][dasize] = { { 0, 1, 2 }, { 3, 4, 5 }, { 6, 7, 8 } };
for (int i = 0; i < dasize; i++)
{
for (int j = 0; j < dasize; j++)
cout << darray2d[i][j] << " ";
cout << endl;
}
const int fasize = 10;
float farray4d[fasize][fasize][fasize] = {};
return 0;
}
3.2.2.
, , . , , , , , . , , . , , . , , , . int ( int, ), , , 0x22FF00, 0x22FF0.
, , .
3.4. .
#include <iostream>
using namespace std;
int main (void)
{
unsigned int x;
int *pinta;
cin >> x;
// x int;
pinta = new int[x];
for (int i = 0; i < x; i++)
pinta[i] = i;
// [];
delete[] pinta;
return 0;
}
, . , , , , , , . , , .
3.5. .
#include <iostream>
using namespace std;
int main (void)
{
unsigned int x, y;
cin >> x >> y;
//
// x int ;
int **pinta = new int*[x];
// ;
for (int i = 0; i < x; i++)
pinta[i] = new int[y];
// ;
|
|
for (int i = 0; i < x; i++)
delete[] pinta[i];
delete[] pinta;
return 0;
}
3.3. C
++ . , char . char . cstring .
string. .
3.1. .
char *strcat(str1, str2), char *str1, *str2; | |
char *strncat(str1, str2, n); char *str1, *str2; int n; | , n |
int strcmp(str1, str2); char *str1, *str2; | |
int strncmp(str1, str2, n); char *str1, *str2; int n; | n |
char *strcpy(str1, str2); char *str1, *str2; | str1 str2 |
char *strncpy(str1, str2, n); char *str1, *str2; int n; | n str1 str2 |
int strlen(str); char *str; | ( ) |
char *strchr(str, n); char *str; int n; | n |
char *strrchr(str, n); char *str; int n; | n |
char *strpbrk(str1, str2); char *str1, *str2; | str1 str2 |
int strspn(str1, str2); char *str1, *str2; | str1, str2 |
int strcspn(str1, str2); char *str1, *str2; | str1, str2 |
char *strtok(str1, str2); char *str1, *str2; | str1 , str2 |