ThreadBoard ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
hellppp! n00b! :) (Sdk)
hellppp! n00b! :) // SdksweJul 13, 2003, 8:26pm
Sorry about the crossposting, but really need help, not sure where to put it
:) so put it in both bots and sdk! :) ____________________________________________ hey, im having this problem with c++, problem is hard to explain, but it only takes the citnum, nothing else, heres the source code and the output: [Source code] #include "aw.h" #include <iostream> int awLogin(); int main() { int CitNum,NS,EW,Alt,AvNum; char PPW[26],BotName[26],World[20]; std::cout <<"Please enter citizen number:"; std::cin >> CitNum; //std::cout <<CitNum; std::cout <<"Please enter your privillige password:"; std::cin.get (PPW,25); //std::cout << "\n"; std::cout<<"Please enter your bots name:"; std::cin.get(BotName,25); std::cout << "\n"; std::cout<<"Please enter world:"; std::cin.get (World, 19); //std::cout << "\n"; std::cout<<"Please enter N/S coordinates:"; std::cin >>NS; //std::cout << "\n"; std::cout<<"Please enter E/W coordinates:"; std::cin >>EW; //std::cout << "\n"; std::cout<<"Please enter altitude:"; std::cin >>Alt; //std::cout << "\n"; std::cout<<"Please enter avatar number:"; std::cin >>AvNum; //std::cout << "\n"; return 0; } int awLogin() { int rc; // if (rc = aw_init(AW_BUILD)){ // std::cout <<"\nUnable to initilize API (reason:"; // } std::cout<<"test\n"; return 0; } _____________________________________________ [OUTPUT] Please enter citizen number:444 Please enter your privillige password:Please enter your bots name: Please enter world:Please enter N/S coordinates:Please enter E/W coordinates:Please enter altitude:Please enter avatar number:Press any key to continue _______________________________________________ anyone know what the problem is? :) -SWE andrasJul 14, 2003, 12:40am
[View Quote]
> Sorry about the crossposting, but really need help, not sure where to put it
> :) so put it in both bots and sdk! :) > ____________________________________________ > > hey, im having this problem with c++, problem is hard to explain, but it <snip> try the following syntax: std::cin.get(PPW,25) >> PPW; -- Andras "It's MY computer" (tm Steve Gibson) sweJul 14, 2003, 11:50am
mauzJul 14, 2003, 2:34pm
[View Quote]
Me n00b 2, but have you tried cin.getline instead? Or strings.
-- Mauz http://mauz.info scifairJul 16, 2003, 4:08pm
cin.get leaves the line terminator in the stream. So each input is reading
the endline immediately. Either use getline, or extract the endline manually between inputs. -- -Rich [View Quote] |