Forum: C++ Jun 23rd, 2008 |
| Replies: 3 Views: 233 |
Forum: C++ Jun 23rd, 2008 |
| Replies: 3 Views: 233 easiest way to find a slow loop? Hmm, i kinda aint in the mood to dig the net about this, so i guessed i'd post my question here..
I'm not so familiar with the time library...is there a nice easy way to drop some code into the loops... |
Forum: C++ Jun 10th, 2008 |
| Replies: 3 Views: 343 Re: C++ in Vista i haven't used vista really, but it does have the normal cmd prompt, right?
i'd try forcing it by invoking the MS compiler with
C:\yourfolder> cl -GX yoursource.cpp
gotta have ms visual studio stuff... |
Forum: C++ Jun 9th, 2008 |
| Replies: 8 Views: 486 Re: sorting floats/ints inside an array of string this is what i came up with...and it works fine
#include <iostream>
#include <string>
using namespace std;
int posd( string s ){ for( int i = 0; i < s.length(); i++ )if( s[i] == '.' )return i;... |
Forum: C++ Jun 8th, 2008 |
| Replies: 1 Views: 179 lib. string type sizes and that stuff... is there a way to "resize" a lib. string? is there a way to limit/set its size to a value?
umm, and yeh, is there a better algorithm to search for all substrings in a string than this one i've... |
Forum: C++ Jun 8th, 2008 |
| Replies: 8 Views: 486 |
Forum: C++ Jun 8th, 2008 |
| Replies: 8 Views: 486 Re: sorting floats/ints inside an array of string i get all but the substr() thing, but i'll look it up. my way of doing it was addind zeros to the front and the back of the strings until both are equal, then went through to check if they differ... |
Forum: C++ Jun 8th, 2008 |
| Replies: 8 Views: 486 |
Forum: C++ Jun 8th, 2008 |
| Replies: 8 Views: 486 sorting floats/ints inside an array of string okay, this one's supposed to take n numbers, ints/floats, sort them, spit them out...
now i have my code, and it looks fine to me, i'm doing bubblesort while checking with a bool function is the... |
Forum: C++ Jun 6th, 2008 |
| Replies: 9 Views: 345 Re: cstdio input? hmm, i think i get the %g format. and i found out where my error was while doing the integer check. i was doing division on an integer and forgot that in c++ '/' gives integer results. i did a cast... |
Forum: C++ Jun 6th, 2008 |
| Replies: 9 Views: 345 Re: cstdio input? i want them printed as integers if they are, i want the printed with non zero significant digits...for example: input: 1.3 output: 1.3 |
Forum: C++ Jun 6th, 2008 |
| Replies: 9 Views: 345 Re: cstdio input? umm, yea, another question came up... and again, i don't want to post a new thread.
i'm trying to do a float integer check, and it simply doesn't work.
i made a function like this:
bool isint( float... |
Forum: C++ Jun 6th, 2008 |
| Replies: 9 Views: 345 Re: cstdio input? #include <cstdio>
int main( void )
{
int h, m, s; double kh = 0, km = 0;
scanf( "%d%d%d", &h, &m, &s );
for( int i = 0; i < h; i++ )
kh += 30;
for( int i = 0; i < m; i++ )
... |
Forum: C++ Jun 6th, 2008 |
| Replies: 9 Views: 345 Re: cstdio input? hm yeah...the &s, thanks
i have another question, i just don't want to post a new thread...
i've already posted this question but now i'm asking...
"%.5g" prints an integer if there are no digits... |
Forum: C++ Jun 6th, 2008 |
| Replies: 9 Views: 345 cstdio input? i'm having problems reading with scanf...
i'm trying to input some coordinates enclosed in brackets but it kinda skips the input that way...
is it forbidden to say scanf( "(%d,%d) (%d,%d) (%d,%d)... |
Forum: C++ Jun 2nd, 2008 |
| Replies: 1 Views: 154 Array input styles? Is there a nice function or a way of inputing values into an array until newline? i kinda don't like doing it with gets(); and then check if index%2 is 0 and then if it is i store the int(); value of... |
Forum: C++ May 29th, 2008 |
| Replies: 8 Views: 391 Re: Same Old Fibonacci numbers! hmm, i guess it's the same thing as above, but i'm just allergic to iostream..
#include <cstdio>
int main(void)
{
int num, f = 1, s = 1, n;
scanf("%d", &num);
while(s <= num)
... |
Forum: C++ May 26th, 2008 |
| Replies: 6 Views: 674 Re: Sick large number multiplication i get it. i'm not trying to reinvent something that has been invented. I just think i should know how it works. Also, i'm not in the industry (no waaaaii), i'm in school. And i guess my teacher would... |
Forum: C++ May 26th, 2008 |
| Replies: 5 Views: 289 |
Forum: C++ May 26th, 2008 |
| Replies: 5 Views: 289 |
Forum: C++ May 26th, 2008 |
| Replies: 6 Views: 674 |
Forum: C++ May 25th, 2008 |
| Replies: 3 Views: 186 Re: stuck hmm, thanks alot people... i never really did typecasting.. works! |
Forum: C++ May 25th, 2008 |
| Replies: 3 Views: 186 stuck could someone please check this code and tell me where i went wrong... it always gives the result 1.00000 but as you can see in the for loop it shouldn't be like that.
#include <cstdio>
int... |
Forum: C++ May 25th, 2008 |
| Replies: 6 Views: 674 Sick large number multiplication Okay, so i have an idea...that looks like it should work. I'm supposed to be able to multiply for example: 1234567812345678912345678*1234562345673456.
My idea was to put each number into a string,... |
Forum: C++ May 21st, 2008 |
| Replies: 6 Views: 188 |
Forum: C++ May 21st, 2008 |
| Replies: 6 Views: 188 strtoking... i'm trying to get the last word of the sentence using strtok.. i tried this :while (tok != NULL)
{
tok = strtok (NULL, " ");
if((tok != NULL) && (strtok(NULL, " ")==NULL))
... |
Forum: C++ May 9th, 2008 |
| Replies: 5 Views: 590 Re: reversing the words from a sentence umm, yeah, i use some stuff from my own language for the variable and function names...and i'm not too creative at doing that to be honest..:P
i made the space adding function cause it didn't print... |
Forum: C++ May 9th, 2008 |
| Replies: 5 Views: 590 Re: reversing the words from a sentence Umm, i finally came up with this, it's a result of my first idea of nulling... hope you people don't mind, i often mix c# and c++ cause i like the cstdio input.. this is the final thing, please post... |
Forum: C++ May 9th, 2008 |
| Replies: 5 Views: 590 reversing the words from a sentence okays... so i'm looking for some kind of a standard algorithm that doesn't take long.
i thought going backwards, finding the first space, writing the last word and nulling (is that even possible?)... |