Search Results

Showing results 1 to 40 of 52
Search took 0.01 seconds.
Search: Posts Made By: firstPerson ; Forum: C++ and child forums
Forum: C++ 2 Days Ago
Replies: 6
Views: 152
Posted By firstPerson
Oh ok :

for(int i = 0; i !=1; ++i){
cout << "M"<<endl;
for(int thisIsStupid = 0; thiIsStupid != 0; );
}
Forum: C++ 2 Days Ago
Replies: 6
Views: 152
Posted By firstPerson
???

for(int i = 0; i !=1; ++i)
cout << "M"<<endl;
Forum: C++ 8 Days Ago
Replies: 17
Views: 425
Posted By firstPerson
This shouldn't be this hard.

You want to read from a text file of the format :

Firstname;Lastname;178

where the ';' means the word has ended. And you know you will
always read firstname,...
Forum: C++ 9 Days Ago
Replies: 5
Views: 204
Posted By firstPerson
For that you need to read multiple books, and even then you won't know
everything. But to start out, C++ primer plus is a good book. It goes in
details of C++.
Forum: C++ 9 Days Ago
Replies: 9
Views: 317
Posted By firstPerson
Don't worry about that. Just do it with if statements.

For example to sort 2 variable you can do this :

int n = 0;
int m = 0;
cin >> n >> m;

if(n < m )
cout << n << " " << m;
Forum: C++ 10 Days Ago
Replies: 4
Views: 228
Posted By firstPerson
replace the && with the ||. You wan't the loop to run if either currentX OR currentY is not equal to toX or toY, respectively.

Also take out the

else { currentX-- } and else{ currentY-- }
...
Forum: C++ 10 Days Ago
Replies: 2
Views: 308
Posted By firstPerson
The simplest sort, although inefficient. Below is a demonstration of
bubble sort and insertion sort.

The bubble sort just consists of 2 for loops and std::swap.

The insertion sort uses 2...
Forum: C++ 16 Days Ago
Replies: 5
Views: 263
Posted By firstPerson
Yes, but what he is doing is wrong. If you use nothrow
when allocating for memory, then first could be null, if it failed to allocate memory.

like this :

int *p = new(nothrow)...
Forum: C++ 16 Days Ago
Replies: 10
Views: 328
Posted By firstPerson
From what my debugger is telling me, you have a stack overflow on line 544
Forum: C++ 17 Days Ago
Replies: 1
Views: 301
Posted By firstPerson
The function adds two large numeric string together, like "12345667" + "12345678" = ?

It does not have complete error checking, I'll leave that up to you.

It should work but I am prone to bugs,...
Forum: C++ 17 Days Ago
Replies: 7
Solved: Warning help
Views: 274
Posted By firstPerson
>> but my teacher wants the user to be able to be able to input a number of any length

That means that you shouldn't use int, double , long long or whatever.
It means you should get your input as...
Forum: C++ 18 Days Ago
Replies: 36
Views: 1,418
Posted By firstPerson
Good. Now try to be more organized and start learning classes. Once you
have a "good" grasp, convert the code into objects.
Forum: C++ 23 Days Ago
Replies: 6
Views: 221
Posted By firstPerson
use SingletonVector::vBooks.push_back(b);
Forum: C++ 29 Days Ago
Replies: 3
Views: 139
Posted By firstPerson
Don't use goto. Period.

How about you show some code and explain what you are trying to do
Forum: C++ 30 Days Ago
Replies: 8
Solved: glColor problem
Views: 454
Posted By firstPerson
You forgot to enable GL_COLOR_MATERIAL, when using lighting. I
changed it a little, take a look at the comments.

#define GLUT_DISABLE_ATEXIT_HACK
#include <stdlib.h>
#include <GL/glut.h>

...
Forum: C++ 30 Days Ago
Replies: 5
Views: 174
Posted By firstPerson
Your almost there :

1) change : int input; TO int x;
2) Wrap your code in a do while loop.

int x = -1;
do
{
/* get user input and check for even/oddity */
}while(x != 0) //quits if user...
Forum: C++ 32 Days Ago
Replies: 6
Views: 360
Posted By firstPerson
First have the object ready to fire, meaning have the object at the position
of where its going to be launched.

Then you could do something like this :

Ball.y += ball.velY;
Ball.x +=...
Forum: C++ 32 Days Ago
Replies: 9
Views: 286
Posted By firstPerson
your function call should be :

values(value1);
Forum: C++ 33 Days Ago
Replies: 6
Views: 257
Posted By firstPerson
Just for trial, try putting :

using namespace SAMSErrorHandling;

at the top of your main.
Forum: C++ 34 Days Ago
Replies: 8
Views: 521
Posted By firstPerson
Hven't tried it out and its about 3 am but I'll give it a shot :

I will build up :

CASE A : First to create a 1d array :

const int NODE_SIZE = 5;
Node * p = new Node[NODE_SIZE];
Forum: C++ Oct 27th, 2009
Replies: 7
Views: 234
Posted By firstPerson
>>WHAT IS WRONG WITH THIS CODE?
1) You do not use code tags
2) You haven't included the necessary library
3) I don't think you understand what the question is asking, so
understand it before you...
Forum: C++ Oct 26th, 2009
Replies: 3
Views: 196
Posted By firstPerson
Try this :

double norms(double vectorA_xcomponent, double vectorA_ycomponent, double vectorA_zcomponent, double& norm_1)
{
norm_1 =...
Forum: C++ Oct 25th, 2009
Replies: 10
Views: 313
Posted By firstPerson
>>1) The format the user should be entering his matrice should be:
1 2 3 4 5 6 7 8 9 'ENTER'
right now it is 1 'ENTER', 2 'ENTER', 3 'ENTER' ... etc all the way to the 9th number.

what happens...
Forum: C++ Oct 25th, 2009
Replies: 10
Views: 313
Posted By firstPerson
>>1) the style in which the user inputs their numbers for each 3x3 matrix should be - enter all 9 #s and then press enter... as opposed to enter a # press enter (9x)

Ok, whats the problem with...
Forum: C++ Oct 24th, 2009
Replies: 14
Solved: String issue
Views: 347
Posted By firstPerson
print out the sum, cout<<sum << endl;
Forum: C++ Oct 24th, 2009
Replies: 6
Views: 201
Posted By firstPerson
>>I'm storing base class pointers in a vector, the pointers are pointing to objects from the derived class ( Leads ).
>>I'm unable to access the 'getter' functions of the derived class. How can this...
Forum: C++ Oct 23rd, 2009
Replies: 5
Views: 191
Posted By firstPerson
#include<iostream>
#include<windows.h>

int main(){
string str = "hello";
cout<<str<<" ";
Sleep(1000); //wait 1 second
cout<<"world\n";

return 0;
Forum: C++ Oct 22nd, 2009
Replies: 9
Views: 543
Posted By firstPerson
1st) Read post 1, although if you PM, someone that knows a little math, he might help you.

2)



Let A = r+5(r-2)=28
Let B = 3(r+4)+5(r+2)=102
Forum: C++ Oct 12th, 2009
Replies: 1
Views: 226
Posted By firstPerson
which part do you need the help with?

Mean = average = Sum of Total elements / Number of elements

Median is the middle number in a sorted set of numbers

Mode is the most occurring number.
...
Forum: C++ Oct 10th, 2009
Replies: 6
Views: 368
Posted By firstPerson
Wow, this is funny. Hey, I have a lot of exams right now and I am
broke, can you just give me couple of thousands of dollars, so I don't have
to work? Just mail it to me.
Forum: C++ Oct 7th, 2009
Replies: 2
Views: 230
Posted By firstPerson
there is a lot of logic errors, but this one is a compile time error :

cin << yesorno;

you mean cin >> yesorno , right.
Forum: C++ Oct 4th, 2009
Replies: 21
Views: 686
Posted By firstPerson
How about you explain this code. Tell me what each line does.
Then tell me what you think you need to do in order to duplicate a word.

void duplicateWords (nodeType*& first, nodeType*& last)
{
...
Forum: C++ Oct 4th, 2009
Replies: 4
Views: 318
Posted By firstPerson
Try this. And inline won't do anything helpful by the way.


ostream& operator << (ostream& os, FixedSizeMatrix& obj)
{
obj.print(os);
return os;
}
Forum: C++ Oct 3rd, 2009
Replies: 10
Views: 276
Posted By firstPerson
Normally with destructor and constructor,
you should do something like ,

Array(){
mainArray = new Type[0];
}
~Array(){
delete [] mainArray;
}
Forum: C++ Oct 3rd, 2009
Replies: 7
Views: 405
Posted By firstPerson
It seems like you are trying to make a code to send somebody a
harmful .exe.

Therefore I will not tell you.

If i am wrong then say so, trusting you not to lie.
Forum: C++ Oct 2nd, 2009
Replies: 4
c++
Views: 220
Posted By firstPerson
There are basically the same except for their accuracy.

A float is for example the following :

float F = 3.1415f;


And a double is the following :

double D = 3.1415;
Forum: C++ Sep 25th, 2009
Replies: 2
Views: 257
Posted By firstPerson
Haven't used it for a while, but I think it takes the ascii value in int form.

if you wan't to use variable use a char variable


char print ='0';
for(print = '0'; print != '9'; print++)
...
Forum: C++ Sep 23rd, 2009
Replies: 2
Views: 249
Posted By firstPerson
Yes, use template.

You could use template specialization, to make sure that the template
parameters is a number.

Here is a way to do that :

#include <iostream>

using namespace std;
Forum: C++ Sep 19th, 2009
Replies: 5
Solved: openGL or glut
Views: 426
Posted By firstPerson
Well it can do some printing stuff too, but its primary task is to create
the window and get inputs. You should use opengl to draw stuff. Of
course there are some draw stuff that makes your life...
Forum: C++ Sep 18th, 2009
Replies: 7
Views: 609
Posted By firstPerson
portability :

"The actual type of size_t is platform-dependent; a common mistake is
to assume size_t is the same as unsigned int, which can lead to
programming errors, particularly as 64-bit...
Showing results 1 to 40 of 52

 


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

©2003 - 2009 DaniWeb® LLC