i was told in C++ Programming Secound Edition For The Absolute Begginer
as far as my beginner programming skills can tell it looks exactly the same but still it gives me 17 differnt errors! by the way i only started yesterday so is it common for beginners to get this many errors from basic code?
(58)error C2059: syntax error : '}'
(58)error C2143: syntax error : missing ';' before '}
(58)error C2059: syntax error : '}'
(57)error C2059: syntax error : 'return
(45)see declaration of 'cout'
(54)error C2086: 'int cout' : redefinition
(54) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
54) : error C2143: syntax error : missing ';' before '<<'
(45) : see declaration of 'cout'
(52) : error C2086: 'int cout' : redefinition
(52) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
(50) : error C2059: syntax error : '<<'
(45) : see declaration of 'cout'
(49) : error C2086: 'int cout' : redefinition
(49) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
(49) : error C2143: syntax error : missing ';' before '<<'
(45) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
(45) : error C2143: syntax error : missing ';' before '<<'
(42) : error C2059: syntax error : '<<'
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
#include <iostream>
#include <string>
int main(void)
{
using std::cout;
using std::cin;
using std::string;
int buddies;
int afterBattle;
string exit;
cout << "You Are a Pirate and are walking"
<< " along in the crim filled \n"
<< " city of Darkness (in 1789). "
<< "How Many of your pirate buddies \n"
<< "do you bring along? (Any number between 11 and 115)\n";
cin >> buddies;
afterBattle = 1 + buddies - 10;
cout << "Suddenly 10 Elite Musketeers jump out "
<< " from the local tavern and \n"
<< " draw their swords. "
<< "10 musketeers and 10 pirates die in the \n"
<< "battle. There are only "
<< (buddies + 1 - 10)
<< " pirates left, including you \n\n";
cout << " the fallen drop a total of 107 gold coins.\n"
<< " the bounty is split evenly, which works out to "
<< (107 / afterBattle) << " gold coins \n"
<< "for each survivor. \n";
cout << "The Last " << (107 % afterBattle) << " are fought over "
<< "in a big drunken brawl.\n";
cout << "These last few coints are spent on more booze during the \n"
<< "course of the brawl. Eventually everyone Retires\n"
<< " peacefully on the bar room floor. \n"
<< " another successful day as a pirate!\n";
return 0;
}
<< (buddies + 1 - 10)
<< " pirates left, including you.\n\n";
cout << " the fallen drop a total of 107 gold coins.\n"
<< " the loot is split evenly witch works out to "
<< (107 / afterBattle) << " gold coins \n"
<< " for each survivor leaving ";
cout << (107 % afterBattle) << " unclaimed.\n";
<< "How many of your pirate buddies \n"
<< " do you bring along? (Any number between 11 and 115)\n";
cout << "You and the others argue over who should get the extra \n"
<< " coins. and soon a big drunken brawl breaks out! \n\n";
cout << " In the end you are triumphant and "
<< (107 / afterBattle) + (107 % afterBattle)
<< " coins richer!\n\n";
return 0;
}
|