游戏设计里的砍血程序C++意淫版

#include
#include

using namespace std;

char *getname(void)
{
    char temp[80];
    cout << "Enter the name: ";
    cin >> temp;
    char *pn = new char[strlen(temp) + 1];
    strcpy(pn,temp);
    return pn;
}

void putname(char *name)
{
    char *dame;
    dame = name;
    cout << dame << " at " << (int *)dame << endl;
    delete [] dame;
}

void add(void)
{
    int i;
    cout << "Enter the loop number: ";
    cin >> i;
    while(i > 0)
    {
        putname(getname());
        i--;
    }
}

int main()
{
    char *getname(void);
    void putname(char *name);
    void add(void);
    add();
    return 0;
}

 

你可能感兴趣的:(C++)