+ 1
why does this short program keep telling me that strings a-j are not declared?
#include <iostream> #include <string> using namespace std; int main() { string a,b,c,d,e,f,g,h,i,j; int choice1; int choice2; int p1points; int p2points; a=threadwire; b=hammer; c=knife; d=acid; e=pistol; f=rifle; g=grenade; h=bazooka; i=rpg; j=tank;
4 Respostas
+ 5
you forgot to add your quotes to the declaration of string. for example f="rifle" instead of f=rifle. the latter is saying set variable f equal to variable rifle which doesn't exist
+ 2
thanks destro. it worked. really helpful
+ 2
we should declare it like a="jac"; and not a=jac because jac is not a variable. if it is str a="abc" ;
str b="a";
then a is abc and b a but if it is b=a;
b is abc
- 2
how r u guys ??