Академический Документы
Профессиональный Документы
Культура Документы
++ -
- ,
= "" +
, ..
= +
+
,
..
QDate
QDate birthday(1990, 3, 23)
, ,
------------------- , ,
, ,
= 1990, = 3, = 23
------------------- , ,
, ,
()
birthday:
1990
3
23
, ,
birthday:
, ,
, ,
(,
)
,
:
QDate date; // // ,
6
, , , 23.03.1990
//
//
,
.
++ ,
(
)
QDate
QDate () /* */
QDate ( int y, int m, int d ) /*
y, m
d*/
-
, :
10
QDate :
QDate ()
QDate ( int y, int m, int d )
, QDate:
QDate nullDate;
//
//
//
QString ()
:
12
QString () /*
*/
QString ( const char * str ) /*
, ASCII
str*/
QString ( int size, char ch ) /*
size,
ch*/
// 1 -
QString str(15, 'A');
// 2
QString str("AAAAAAAAAAAAAAA");
13
14
,
,
, ,
QDate
:
QDate :
15
//
QDate date1(1991, 11, 15);
QDate date2(1991, 11, 15);
//
// date1
date1.setDate(2000, 12, 31);
//
// date2
int week = date2.weekNumber();
//
//
16 bool isValiDate = QDate::isValid(2000, 13, 45);
<>.< >(<>)
17
(
),
.
(
),
QString
int length () const
int strlen (const char *str)
18
QString :
// str
QString FIO("");
//
QString fisrtName("");
//
QString name("");
//
QString patronymic("");
//
19
FIO ,
,
//
//
20
FIO.append(fisrtName);
//""
FIO.append(space);
//" "
FIO.append(name);
//" "
FIO.append(space);
//" "
FIO.append(patronymic);
//" "
,
,
,
<>.< 1_1>.< 2_1>
1_1 2
1
1_1
1_2
21
2
2_1
2_2
2_3
QDate
// ,
QString
//
QString ("23.03.2009")
23
::
,
QString
int compare (
const QString & s1,
const QString & s2 )
int strcmp(
const char *s1,
const char *s2 )
QString str1("one");
QString str2("two");
int result =
int result =
QString::compare(str1,
strcmp(str1, str2);
str2);
24
QDate , :
QDate currentDate ()
,
QDate cDate;
25
QDate cDate;
//
cDate = QDate::currentDate();
,
26
QDate , :
QDate currentDate ()
int
int
int
int
int
int
27
day () const
dayOfWeek () const
dayOfYear () const
daysInMonth () const
daysInYear () const
daysTo ( const QDate & d ) const
- cyDays
int cyDays;
// -
cyDays = QDate::currentDate().daysInYear();
//
++
29
++
, /
,
30
QString
:
QString & remove ( int position, int n )
// n , position
QString & remove ( const QString & str)
// str
QString & remove ( QChar ch)
// ch
str.remove(1,1).remove(cat);
32
++ () (
+, =, [] ..)
. QDate
:
bool
bool
bool
bool
bool
33 bool
operator!=
operator<
operator<=
operator==
operator>
operator>=
(
(
(
(
(
(
const
const
const
const
const
const
QDate
QDate
QDate
QDate
QDate
QDate
&
&
&
&
&
&
d
d
d
d
d
d
)
)
)
)
)
)
const
const
const
const
const
const
34
//
date1.operator<(date2);
//
date1 == QDate::currentDate();
//
, , :
35
,
:
QString :
:
bool
bool
bool
bool
operator<
operator<
operator<
operator<
(const
(const
(const
(const
, :
38
++ ,
:
39
QString ,
n :
QString & setNum ( int n, int base = 10 )
40
base ,
.
,
10:
QString str;
str.setNum(11, 2);
str.setNum(11);
// 1011
// 11
QString
/*
str */
"", ,
,
41
// ,
//
int index = str.indexOf( QString("") );
42
++
,
* -> &
:
< > &< >;
43
void main(void)
{
int k = 5, m = 2;
void main(void)
{
int k = 5, m = 2;
swap(&k, &m); // k = 2,
// m = 5
44 }
swap(k, m);
}
// k = 2,
// m = 5
, ,
, .. , ,
:
int
compare
const
QString
&
other
const
//
QString str1(""), str2("");
str1.compare(str2);
45
, .
:
QString str("1234112");
str.remove("1").remove("2"); //str = "34"
str = "2342"
QString
&
remove
(
Qt::CaseSensitivity cs
46
const
QString
&
str,
= Qt::CaseSensitive )
//
< >(< >)
:
QString str =
QString(" ") + QString("");
47
QString
:
QDate
QString toString ( Qt::DateFormat format) const
// ,
QDate date(2007, 7, 7); //
QString str = date.toString("dd.MM.yyyy");
48
QString
49
++
new,
new (
):
new < >
:
new < >[<- >]
new malloc
( )
( )
delete:
delete
delete < >
:
delete [] < >
50
51
relations N
( QString),
-
int N = 5;
// -
// N
QString * relations = new QString[N];
//
relations[0] = QString(" ..");
// N
delete [] relations;
52