Search Results

Showing results 1 to 40 of 1000
Search took 0.06 seconds.
Search: Posts Made By: firstPerson ; Forum: C++ and child forums
Forum: C++ 36 Minutes Ago
Replies: 4
Views: 46
Posted By firstPerson
Sure but why ?

int cntr = 0;

while(cntr < length )
{
//do code
cntr++;
}
Forum: C++ 57 Minutes Ago
Replies: 4
Views: 46
Posted By firstPerson
You almost have it, what you need to change is :

string found(float myarr[], float item, int length);
{
//need a for loop not a while
for(int i=0; i<=(length-1);i++)
{
if...
Forum: C++ 1 Hour Ago
Replies: 1
Views: 53
Posted By firstPerson
>>const double PI=2.0 * asin(1.0);

Just Do : const double PI = 3.14159265;

no reason for the call to asin.


>>include a derive class named sphere from the base circle class.

Means :
Forum: C++ 1 Hour Ago
Replies: 5
Views: 85
Posted By firstPerson
Now you need to do this :


This is towards your Account class.
Forum: C++ 1 Hour Ago
Replies: 5
Views: 85
Posted By firstPerson
Remove the global variable and use code tags :

//ACCOUNT.h
#ifndef Account_H
#define Account_H
double credit, debit, balance;

class Account
{
private :
Forum: C++ 1 Hour Ago
Replies: 4
Views: 57
Posted By firstPerson
>>line 44 `main' must return `int'

refers to you having : "void main()";

it should be :

int main(){
//code
return 0;
}
Forum: C++ 1 Hour Ago
Replies: 2
Views: 53
Posted By firstPerson
This part :

if (cin.fail()){
do{

cout<<"Wrong Data Type of Input!";
cout << "Please Enter the Product ID Again : ";
cin >> product[i].id;//whats wrong...
Forum: C++ 1 Hour Ago
Replies: 7
Views: 509
Posted By firstPerson
Pretty cool. Looks something someone will see if they were high of drugs.
Forum: C++ 2 Hours Ago
Replies: 4
Views: 85
Posted By firstPerson
Yes, A goes out of scope and its destructor is called. You should really
have B in the same scope as A. That means B shouldn't be global.





care to elaborate?
Forum: C++ 5 Hours Ago
Replies: 5
Views: 85
Posted By firstPerson
Whenever you have a "big" assignment like that, its really good to break it down. Here is the first thing your should do :
<quote> Create an inheritance hierarchy containing base class Account and...
Forum: C++ 13 Hours Ago
Replies: 6
Views: 130
Posted By firstPerson
Fix to :

if(winner == 0)


Also make use of functions.
Forum: C++ 20 Hours Ago
Replies: 6
Views: 149
Posted By firstPerson
change :

int mod(int &num, int &num2)


to

int mod(int num, int num2)
Forum: C++ 21 Hours Ago
Replies: 6
Views: 205
Posted By firstPerson
But a template class can have default arguments for a template
parameter.


Depends, if you even need it.


What book ?
Forum: C++ 21 Hours Ago
Replies: 11
Views: 260
Posted By firstPerson
1. What is your favorite IDE

Microsoft visual studio. just tried eclipse, and its not bad either.
Both debugger are nice.

2. What is your favorite GUI library

OpenGL, the only one I use. ...
Forum: C++ 1 Day Ago
Replies: 3
Views: 132
Posted By firstPerson
Nope, then it would be ambiguous.
Forum: C++ 1 Day Ago
Replies: 3
Views: 132
Posted By firstPerson
>>output("1", "k"); // ?

should be a string :

output(string("1"), string("k")); // ?


Whats happening is that "1" and "k" is being interpreted as a const char*
Forum: C++ 1 Day Ago
Replies: 3
Views: 132
Posted By firstPerson
cout<<"*"<<endl;
cout<<" *"<<endl;
cout<<" *"<<endl;
cout<<" *"<<endl;
cout<<"*"<<endl;
Forum: C++ 1 Day Ago
Replies: 1
Views: 100
Posted By firstPerson
>>I keep receiving the same output for each record when I run it on the test data. I've tried numerous things...any suggestions?

Yes, learn how to use the debugger! You can't just dump "huge"...
Forum: C++ 1 Day Ago
Replies: 6
Views: 169
Posted By firstPerson
You already did, the displayTitle(); is a function call.

You also might want to make a function that returns the average, given an array and its size.
Forum: C++ 1 Day Ago
Replies: 1
Views: 119
Posted By firstPerson
Well it will ask you questions of what you have covered.
Forum: C++ 1 Day Ago
Replies: 3
Views: 154
Posted By firstPerson
What is enemies?
Forum: C++ 1 Day Ago
Replies: 4
Views: 182
Posted By firstPerson
Is there a particular problem? For you operator >, you can just do :
return !(a < b );
Forum: C++ 1 Day Ago
Replies: 6
Views: 169
Posted By firstPerson
#include <iostream>
using namespace std ;

void displayTitle ()
{
cout << "Active Duty Navy personnel Program" << endl ;
}

int main ()
{
Forum: C++ 1 Day Ago
Replies: 1
Views: 124
Posted By firstPerson
Your highest function should return an INT, and that int should be
the index of the highest element in that array. Change that first.

Next, your highest function is almost correct, except that...
Forum: C++ 1 Day Ago
Replies: 6
Views: 205
Posted By firstPerson
Virtual functions and polymorphism are closely related.

A virtual function means that a some class with a virtual function will be derived from, and that virtual function will be overridden by...
Forum: C++ 2 Days Ago
Replies: 9
Views: 413
Posted By firstPerson
This function is a total mess :

void NumberStorage::generate(int n)
{
srand(unsigned(time(0)));
n = 0;
int* ArrayOne = NULL;

ArrayOne = new int[n];
Forum: C++ 2 Days Ago
Replies: 1
Views: 129
Posted By firstPerson
Test all cases if you can. If not then test the extrema. Then test randomly.
More test the better.
Forum: C++ 2 Days Ago
Replies: 6
Views: 184
Posted By firstPerson
Then you know almost everything you need to know. All you need to know is how to link them. And the way to link them would be using a linked list.
Have you learned about them ?
Forum: C++ 2 Days Ago
Replies: 3
Views: 146
Posted By firstPerson
can't you just use a function :


int generateGameID(){
static int i = 0;
++i;
return i;
}
Forum: C++ 2 Days Ago
Replies: 6
Views: 184
Posted By firstPerson
So do you know how to create a regular 1d array of size n, dynamically?
Forum: C++ 3 Days Ago
Replies: 4
Views: 148
Posted By firstPerson
no such thing as deconstructor and deinitiailazing, in fact that's not even a word. I assume you mean destructor.
Forum: C++ 3 Days Ago
Replies: 8
Views: 228
Posted By firstPerson
How about using strings to represents float, char, double, int, and so on.
string Types[4] = { "124","1.234","aString","c" };

Then you can convert it accordingly with sstream.
Forum: C++ 3 Days Ago
Replies: 5
Views: 192
Posted By firstPerson
//items are equal
else if(list1=list2)


or

// is items equal ?
else if(list1== list2)
Forum: C++ 3 Days Ago
Replies: 4
Views: 148
Posted By firstPerson
That usually means that your variable contains junk and you haven't
initialized it to anything. I am guessing its a double variable somewhere in
your program.


Approximately it also means...
Forum: C++ 3 Days Ago
Replies: 14
Views: 320
Posted By firstPerson
To use timer, you need to use the clock function. Maybe this example will help you :


#include <iostream>
#include <ctime> //for clock()

using namespace std;

bool myPrint()
{
Forum: C++ 3 Days Ago
Replies: 3
Views: 129
Posted By firstPerson
There must be something else thats wrong with your code then. Want to post it?
Forum: C++ 3 Days Ago
Replies: 3
Views: 129
Posted By firstPerson
const int REPEAT_CODE = 666;
int userInput = 666; //could be any value for now

do{
runGame();
getInput();
}while(REPEAT_CODE == userInput);
Forum: C++ 3 Days Ago
Replies: 6
Views: 138
Posted By firstPerson
Thats ok. All you needed to do was a minor change :

int highestScore(PlayerData [], int size , string& playerName)
{
//set the highest Point to the first player's score

int highest =...
Forum: C++ 3 Days Ago
Replies: 14
Views: 320
Posted By firstPerson
These variable are used for numbers :
int word, a, perfume;

What you need to use is something that can handle words, like std::string;
string word, a, perfume;

Also I notice that "a"...
Forum: C++ 3 Days Ago
Replies: 5
Views: 118
Posted By firstPerson
First your temp variable is not initialized but you use it.

Second check this (http://www.daniweb.com/code/snippet238610.html)and see if it help, look particularly at the logic inside the loop....
Showing results 1 to 40 of 1000

 


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

©2003 - 2009 DaniWeb® LLC