0
#include <iostream>
#include <string>
#include <random>
#include <Windows.h>
using namespace std;


    int playerHP = 20;
    int enemyHP = 20;
    int playerAtk =(rand()%4 + 5); //Find a random number between 5 and 8
    int playerDef = (rand()%4 + 5);
    int playerAgi = (rand()%4 + 5);
    int enemyAtk = (rand()%4 + 4); //Find a random number between 5 and 7
    int enemyDef = (rand()%4 + 4);
    int enemyAgi = (rand()%4 + 4);
    cout<<"---------------"<< endl; // what in the sam hill is going on
    cout<<"FIGHTER STATS"<< endl;
    cout<<"----------------"<<endl;
    cout<<"Player Stats:"<<endl;
    cout<<"HP "<<playerHP<<endl;
    cout<<"ATK "<<playerAtk<<endl;
    cout<<"DEF "<<playerDef<<endl;
    cout<<"AGI "<<playerAgi<<endl;
    cout<<"ENEMY STATS:"<<endl;
    cout<< "HP "<<enemyHP<<endl;    
    cout<<"ATK "<<enemyAtk<<endl;
    cout<<"DEF "<<enemyDef<<endl;
    cout<<"AGI "<<enemyAgi<<endl;

私の cout ステートメントが私のプログラムに非常に多くのバグを作成している理由を理解できないようです。これは明らかに私のプログラム全体ではありませんが、簡潔でわかりやすいものにしたかったのです。エラー C2143:syntax eerror : missing ';' が表示されます '<<' の前に、C4430: 欠落している型指定子-int が想定され、C2086 'int cout':redefinition がほとんどすべての cout ステートメントにあり、その理由がわかりません。すべての助けに感謝し、可能な限り物事を馬鹿にしてください。これは私の最初のC++プログラムです。

4

1 に答える 1