Search Results

Showing results 1 to 40 of 387
Search took 0.05 seconds.
Search: Posts Made By: iamthwee ; Forum: C++ and child forums
Forum: C++ 28 Days Ago
Replies: 1
Views: 361
Posted By iamthwee
// strings and c-strings
#include <iostream>
#include <cstring>
#include <string>
#include <vector>

using namespace std;

vector<string> SplitString (string aString)
{
Forum: C++ Oct 13th, 2009
Replies: 3
Views: 291
Posted By iamthwee
Next time don't leave your h/w to the last minute.
Forum: C++ Oct 11th, 2009
Replies: 8
Views: 325
Posted By iamthwee
oops i meant


vector<bool>setlist;
setlist.push_back(true);
setlist.push_back(false);
setlist.push_back(true);
setlist.push_back(true);
Forum: C++ Oct 11th, 2009
Replies: 8
Views: 325
Posted By iamthwee
I think your easiest answer would be

vector<int>setlist;
setlist.push_back(3);
setlist.push_back(12);
setlist.push_back(4);


string s1 = ",";
cout << "{";
Forum: C++ Oct 11th, 2009
Replies: 8
Views: 325
Posted By iamthwee
Well at the end can't you just do an string erase on the last but one element?

string p = "{1,2,3,24,}";
p.erase(p.length()-2,1);
Forum: C++ Sep 28th, 2009
Replies: 23
Solved: Parsing in C++
Views: 667
Posted By iamthwee
Well if you WANT to allow duplicates all you need is a std::vector
Forum: C++ Sep 28th, 2009
Replies: 23
Solved: Parsing in C++
Views: 667
Posted By iamthwee
>! myfile.eof()

using that is not advised.

And use std::string instead.
Forum: C++ Sep 17th, 2009
Replies: 3
Views: 571
Posted By iamthwee
set a variable at the beginning then add them all up:

eg.

int total = 0;

for ( int i = 0; i < 10; i++ )
{
total = total + i;
}
Forum: C++ Aug 26th, 2009
Replies: 11
Views: 518
Posted By iamthwee
Maybe might be of use?

http://www.daniweb.com/code/snippet900.html
Forum: C++ Jul 21st, 2009
Replies: 8
Views: 352
Posted By iamthwee
> BTW, iamthwee, you forgot a zero at the end of the number

yeah a typo, I still think you need the +1 which makes the answer
30.89, which rounds to 31?

For example in his example:

4th week...
Forum: C++ Jul 21st, 2009
Replies: 8
Views: 352
Posted By iamthwee
#include <cmath>
#include <iostream>

using namespace std;
int main ()
{
cout << ( log ( 100000000.0 ) / log ( 2.0 ) ) + 1;
getchar();
}
Forum: C++ Jul 21st, 2009
Replies: 8
Views: 352
Posted By iamthwee
Just thinking aloud so most probably wrong.

Can't you just take logs to find the answer?
Forum: C++ Jul 20th, 2009
Replies: 14
Views: 564
Posted By iamthwee
int i = 0;

while ( std::getline ( inFileStream, line ) )
{

file[i] = line;
//cout <<line<<endl;
i++;
}
Forum: C++ Jul 13th, 2009
Replies: 4
Views: 319
Posted By iamthwee
Or those of you that like using std:strings etc.


#include <algorithm>
#include <cctype>
#include <iostream>
#include <string>

int lowercase ( int c )
{
Forum: C++ Jun 26th, 2009
Replies: 17
Solved: plz solve this
Views: 472
Posted By iamthwee
I'm sorry but that doesn't tell us much.

Post all your code including your text file and the code you use to read in that password.
Forum: C++ Jun 23rd, 2009
Replies: 6
Views: 291
Posted By iamthwee
Yes, but the OP already stated in another thread, that he/she is forced to use turbo c++ at their school.
Forum: C++ Jun 8th, 2009
Replies: 3
Views: 472
Posted By iamthwee
Well can't use just do #include <string> in main() then?
Forum: C++ Jun 8th, 2009
Replies: 8
Views: 252
Posted By iamthwee
Well do you know what pass by reference means, if not read up on it.
Forum: C++ Jun 8th, 2009
Replies: 8
Views: 252
Posted By iamthwee
& is pass by reference is that what you require?
Forum: C++ Jun 8th, 2009
Replies: 8
Views: 252
Posted By iamthwee
why have you got a temp, surely you would just pop anything that is negative and that's that.
Forum: C++ May 29th, 2009
Replies: 8
Solved: c++ error code?
Views: 469
Posted By iamthwee
try changing

char a;
a = 'A';

to:
string a;
a = "A";

and do a
Forum: C++ May 27th, 2009
Replies: 2
Views: 168
Posted By iamthwee
maybe rec[0] == rec[rec.length()-1]
Forum: C++ May 22nd, 2009
Replies: 7
Views: 359
Posted By iamthwee
You need to give more details than that. What exactly are you using?
Forum: C++ May 20th, 2009
Replies: 5
Views: 241
Posted By iamthwee
Forum: C++ May 15th, 2009
Replies: 6
Views: 247
Posted By iamthwee
You might be better asking this question in a GTK forum.
Forum: C++ May 15th, 2009
Replies: 11
Views: 446
Posted By iamthwee
Ah OK then I didn't realise find in <algorithm> was different. However, it doesn't excuse your profanity.
Forum: C++ May 15th, 2009
Replies: 11
Views: 446
Posted By iamthwee
> Bull-!@#$ of code was that. Simply lost all purpose of find()
Calm down chicken.

My example does probably what the OP requires in simpler terms.
find() returns an integer of the position of...
Forum: C++ May 15th, 2009
Replies: 11
Views: 446
Posted By iamthwee
Alternatively,

for ( int i = 0 ; i < v.size(); i++ )
{
if ( v[i].name == "Misco" )
{
cout << "FOUND\n";
cout << v[i].name << endl;
cout << v[i].age << endl;
}
Forum: C++ May 13th, 2009
Replies: 5
Solved: Fraction
Views: 313
Posted By iamthwee
And use Euclid's GCD.
Forum: C++ May 7th, 2009
Replies: 2
Views: 815
Posted By iamthwee
A bit different but you get the idea, here int y is the end position as opposed to the length.


#include <iostream>
#include <iomanip>
#include <string>

using namespace std;
Forum: C++ May 1st, 2009
Replies: 2
Views: 498
Posted By iamthwee
Should be able to just do a comparison.

Maybe using the c-style string compare function. Can't remember what it is cos I never use c-style strings in c++
Forum: C++ Apr 29th, 2009
Replies: 9
Solved: c++ help2
Views: 351
Posted By iamthwee
What do you mean it "isn't works"?

Do you get a compiler error, is the output completely wrong, is it just wrong by a bit. Tell us what you mean.
Forum: C++ Apr 8th, 2009
Replies: 19
Views: 1,340
Posted By iamthwee
http://www.daniweb.com/code/snippet233.html, oops missed the purpose of calculating last non-zero digit which makes the algorithm simpler. :)
Forum: C++ Apr 5th, 2009
Replies: 5
Views: 411
Posted By iamthwee
I see this as one of those clearing the console windows questions...
Forum: C++ Mar 12th, 2009
Replies: 10
Views: 923
Posted By iamthwee
cout << data[i] << "\n" << endl;

change to:

cout << data[i] << " ";
Forum: C++ Mar 5th, 2009
Replies: 7
Views: 835
Posted By iamthwee
Try this:


#include <iostream>
#include <string>
#include <stack>

class Foo
{
public:
Forum: C++ Mar 1st, 2009
Replies: 12
Views: 627
Posted By iamthwee
So what are you saying the page opens OK as a html on your local machine but not on your server?
Forum: C++ Feb 21st, 2009
Replies: 14
Views: 856
Posted By iamthwee
Looks OK to me, nicely separated into functions...

fflush(stdin) looks a bit dubious
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1052863818&id=1043284351
Forum: C++ Feb 4th, 2009
Replies: 2
Views: 585
Posted By iamthwee
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>

using namespace std;

int main()
{
Forum: C++ Jan 15th, 2009
Replies: 13
Views: 1,074
Posted By iamthwee
Use of std::strings etc? No?
Showing results 1 to 40 of 387

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC