ok!thank you!
Type: Posts; User: boyhailong
ok!thank you!
if don't use std::string ,how to write ?
#include <iostream>
using namespace std;
class String
{
public:
String(const char *str = NULL); // 通用构造函数
String(const String &another); // 拷贝构造函数
~ String(); // 析构函数
String& operator...
thank you for your answer. ihave correct it and test correctly.
#include<iostream>
using namespace std;
const int DefaultSize = 100;
class List
{
public:
List();
List(size_t size);
List(List &L);
~List();
ok , that's the thing ,i correct it ,thank you !
i just want to calculate the length of char*,so i write
int len(char* str)
{
int i = 0;
while (*str != "/0")
{
++i;
++str;
}
i just write a class below :
#include<iostream>
using namespace std;
const int DefaultSize = 100;
class List
{
public:
List();
List(size_t size);
who can explain ? thank you
yes , the template programming just can solve the question !
that's right! the size of the array should be included in the display function not compare with NULL, because the compile just take 0 as NULL, so when *t=0,the loop is over ,and you do twice...
i think in this easy program , the easy syntax structure is enough !
show your code maybe clear!
very good !
it looks like C#
you can write like this :
//Purse
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
class Purse
{
you can clear the buffer in cin before input just like this :
// print your name n times
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <string>
using namespace std;
#include<iostream>
using namespace std;
class X
{
private:
int x;
public:
X():x(){};
void d(){cout<<x;};
void test(X p)
good !