Search found 25 matches

by littledump
Tue Nov 12, 2002 5:45 am
Forum: C++
Topic: Quick Question on std::string
Replies: 1
Views: 1930

Quick Question on std::string

how do i go about converting a std::string to an int or float?

as well is there an equiviant to sprintf for the c++ std::string object?

any other information on std::string would be very helpful as well.

i havent used it very much & could use as much info as possible

thanks
by littledump
Sat Nov 09, 2002 7:09 pm
Forum: Volume 4 (400-499)
Topic: 440 - Eeny Meeny Moo
Replies: 18
Views: 4209

well. i made one small change. i dont think it was significant enough to cut over 9 seconds off though, but i guess it was. it now runs in 1.709 seconds

heres my new code:

[cpp]/*
*
* Solves #440 - Eeny Meeny Moo
*
*/

#include <iostream>

using namespace std;

void main(void) {

int *cityOnNet ...
by littledump
Sat Nov 09, 2002 7:25 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 319780

the problem is youre reading from files

when submitting to this judge, input comes from stdio

so in c++ the way i do it is

[cpp]#include <iostream>

using namespace std;

while(cin >> someVariable){

yourProblemSolvingCodeHere

}[/cpp]
by littledump
Sat Nov 09, 2002 6:49 am
Forum: Volume 4 (400-499)
Topic: 440 - Eeny Meeny Moo
Replies: 18
Views: 4209

im also sending this in through the online submission page

any chance that could have anything to do with it?

most likely not i guess?
by littledump
Sat Nov 09, 2002 6:36 am
Forum: Volume 4 (400-499)
Topic: 440 - Eeny Meeny Moo
Replies: 18
Views: 4209

i compiled using input from files

it took about 12 seconds to do all 147 valid inputs

why cant it do 5 in 10 seconds for the judge?
by littledump
Fri Nov 08, 2002 5:31 pm
Forum: Volume 4 (400-499)
Topic: 440 - Eeny Meeny Moo
Replies: 18
Views: 4209

might the following have something to do with it

or should i say lack of the follow:

[cpp]
using namespace std;
[/cpp]

?
by littledump
Fri Nov 08, 2002 5:20 pm
Forum: Volume 4 (400-499)
Topic: 440 - Eeny Meeny Moo
Replies: 18
Views: 4209

but compiling and running my code on my pc, it runs extremely fast. evidently < 1 sec for all valid input 3<=n<=150. i do not understand why when it gets to input 5, at about 5 secs, it takes more than 5sec to solve it. There must be another problem?
by littledump
Fri Nov 08, 2002 2:09 pm
Forum: Volume 4 (400-499)
Topic: 440 - Eeny Meeny Moo
Replies: 18
Views: 4209

thanks

that now makes it terminate on my end

but when i submitted again, it still execeeds time

it gets stuck on input 5 it seems
by littledump
Fri Nov 08, 2002 6:00 am
Forum: Volume 4 (400-499)
Topic: 440 - Eeny Meeny Moo
Replies: 18
Views: 4209

actually i decided to post my code anyway. it executes really quick when i use it.

[cpp]
/*
*
* Solves #440 - Eeny Meeny Moo
*
*/

#include <iostream.h>

void main(void) {

int *cityOnNet, *cityOffNet;
int citiesOff, citiesOn, nextCity, numCities, m;

while(cin >> numCities != 0) {
cityOnNet ...
by littledump
Fri Nov 08, 2002 5:42 am
Forum: Volume 4 (400-499)
Topic: 440 - Eeny Meeny Moo
Replies: 18
Views: 4209

440

My 440 works, i tested with all sample input, but it goes over the 10 seconds.

When i compile and run & i hit 0, the program wont terminate, but it wont let me type

If you wish to see my code, i will post it
by littledump
Mon Jun 10, 2002 12:20 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 319780

not sure as of right now but...

did u try all possible cases to ensure the output is correct?
by littledump
Sun Jun 09, 2002 4:06 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 319780

cout << "Integers must be between 0 and 10000.\n";

neither is that, but that else condition should never be satisfied anyway.

also might wanna throw a @begin_of_source in there to be safe :)
by littledump
Sun Jun 09, 2002 5:50 am
Forum: C++
Topic: char*
Replies: 7
Views: 4235

i get an error when trying to include <string>. it doesnt exist

and bool doesnt work.

mebbe someone with borland will enlighten me
by littledump
Sun Jun 09, 2002 5:35 am
Forum: C++
Topic: char*
Replies: 7
Views: 4235

ive tried bool in lowercase & i dont thing my compiler has that string object.

mebbe time for new compiler
by littledump
Sun Jun 09, 2002 5:14 am
Forum: C++
Topic: char*
Replies: 7
Views: 4235

how do u reallocate memory & how do i use the string object?

also i tried declaring a BOOL variable but got an error.


using borland c++ 3.0 for dos

Go to advanced search