Search Results

Showing results 1 to 40 of 44
Search took 0.01 seconds.
Search: Posts Made By: invisal ; Forum: C++ and child forums
Forum: C++ 25 Days Ago
Replies: 4
Views: 481
Posted By invisal
int xMin = -10;
int xMax = 10;

double xData[xMax - xMin];

xData contains 20 elements starting from 0 to 19.


int counter = xMin;
for (counter; counter <=xMax; counter++) {
Forum: C++ Aug 4th, 2009
Replies: 24
Views: 770
Posted By invisal
My bad :(

You are totally right.
Forum: C++ Aug 4th, 2009
Replies: 24
Views: 770
Posted By invisal
You can't simply compare 2 strings with operator ==. There is a function in library <string> called strcmp().


Syntax:
int strcmp(string1, string2)

Return:
Return 1 if string1 >...
Forum: C++ Jun 29th, 2009
Replies: 3
Solved: Calculator Game
Views: 210
Posted By invisal
while (tryanother = 'y')

Change = to ==
Forum: C++ Jun 27th, 2009
Replies: 13
Views: 570
Posted By invisal
Initializing the elements of an array a1 and size n randomly, so that its elements have values between [1-45].

I think the assignment want us to create an array with random size in runtime.
Forum: C++ Jun 27th, 2009
Replies: 13
Views: 570
Posted By invisal
Posting the whole assignment will not help you or help us know what you have problem with. If you do not understand the logic, tell us which part that you don't understand. Tell us more about what...
Forum: C++ Aug 15th, 2008
Replies: 13
Views: 2,520
Posted By invisal
It is quite simple. User input the value into number not A[number]. So it should be sum = sum + number.
Forum: C++ Jul 17th, 2008
Replies: 8
Views: 814
Posted By invisal
Mathematically, you can just constantly substract the dividend with divisor and count it until the dividend become smaller than the divisor. If dividend become 0 after it's been constantly...
Forum: C++ Jul 17th, 2008
Replies: 6
Views: 975
Posted By invisal
Of course you can have multiple of them. However, try to avoid using it as much as possible since most of the time goto can be replaced with a loop. For some case such as break multiple-level of...
Forum: C++ Jul 17th, 2008
Replies: 6
Views: 975
Posted By invisal
Then use goto


for (int a=0; a<10; a++) {
for (int b=0; b<10; b++) {
for (int c=0; c<10; c++) {
if (b == 5)
goto endloop;
}
}
Forum: C++ Jul 16th, 2008
Replies: 4
Views: 417
Posted By invisal
I haven't read all of your code because it is hard to read wihtout code tag. However, I think your sort should be in this way:


string temp;

for (int j = 0; j < capacity-1; j++) {
for(int i...
Forum: C++ Jul 16th, 2008
Replies: 4
Views: 417
Posted By invisal
You have sorted your income array and that is the reason why.
Forum: C++ Jul 16th, 2008
Replies: 19
Solved: C++ possible?
Views: 1,490
Posted By invisal
I think you didn't provide enough information about your project. For example: how the loop produce the combination? how will you compare those combination? what is the purpose of your combination?...
Forum: C++ Jul 13th, 2008
Replies: 11
Views: 899
Posted By invisal
return number * (byThePower(number , power - 1));

I don't know how to explain it, so I would rather show how it process: Let say power = 4

Number to return = number * byThePower(number, 3)
...
Forum: C++ Jul 13th, 2008
Replies: 11
Views: 899
Posted By invisal
I would write it like this: (this code works only when the power is a positive number)

int byThePower(int number, int power)
{
if (power >= 1)
return number * (byThePower(number ,...
Forum: C++ Jul 13th, 2008
Replies: 11
Views: 899
Posted By invisal
int ans,num,power1 ;
num =1;

Why you declare something that you didn't use?


number=number*number;
power--;
return(byThePower(number,power));
Forum: C++ Jan 26th, 2008
Replies: 20
Views: 2,458
Posted By invisal
I don't feel that your code works 100% correctly. What's happen when the first digit is number 9? 9 < 9 == false.
Forum: C++ Jan 20th, 2008
Replies: 9
Views: 907
Posted By invisal
a++ mean a = a + 1.
so (!a)++ mean !a = !a + 1 which !a is not a variable.
Forum: C++ Jan 7th, 2008
Replies: 6
Views: 1,792
Posted By invisal
std::cout and std::endl, I believe.
Forum: C++ Jan 4th, 2008
Replies: 8
Views: 741
Posted By invisal
cin.getline(p,50);

The reason why it does read only 49 characters because the computer need the last character to be a NULL character.
Forum: C++ Jan 4th, 2008
Replies: 6
Views: 722
Posted By invisal
You need 3 files:

golf.h contains the functions declaration.
golf.cpp contains the definition of the function in golf.h
main.cpp contains the main() function
Forum: C++ Jan 1st, 2008
Replies: 7
Views: 854
Posted By invisal
if (board[rownum-1][colnum-1] == 'X' or board[rownum-1][colnum-1] == '0')

What language are you using?


char board[ROWS][COLUMNS]=
{ {'.' , '.' , '.' , '.' , '.' , '.' , '.' , '.' , '.' ,...
Forum: C++ Jan 1st, 2008
Replies: 10
Views: 1,259
Posted By invisal
The file that you attempt to read is not exist. To track this kind of error, I would suggest you to use std::cout inserting method.


void ReadFile()
{ char fname[13],ch;

cout<<"Enter...
Forum: C++ Dec 30th, 2007
Replies: 13
Views: 1,304
Posted By invisal
I truthfully don't know what the problem is.
Forum: C++ Dec 30th, 2007
Replies: 13
Views: 1,304
Posted By invisal
Can you post a few lines of code around the error line?
Forum: C++ Dec 30th, 2007
Replies: 13
Views: 1,304
Posted By invisal
Check line 265, if there is missing semi-colon..
Forum: C++ Dec 30th, 2007
Replies: 16
Solved: arrays proplem
Views: 2,995
Posted By invisal
for(int i=1 ; i<51 ; i++) {
{

cout<<setw(3)<<alpha[i-1]<<" ";
if( (i+1)%10 == 0)
cout<<endl;
}

}
Forum: C++ Dec 30th, 2007
Replies: 16
Solved: arrays proplem
Views: 2,995
Posted By invisal
It should be:

if( (i+1)%10 == 0)

Because i was started from 0
Forum: C++ Dec 30th, 2007
Replies: 16
Solved: arrays proplem
Views: 2,995
Posted By invisal
After you successfully initialize your array, you create another loop for print each element of your array. Every 10 elements, you insert the newline character. (Hint: everytimes the counter is...
Forum: C++ Dec 29th, 2007
Replies: 16
Solved: arrays proplem
Views: 2,995
Posted By invisal
If you want to use only one loop, you don't need to use condition.


for(int i =0; i<25; i++) {
alpha[i] = i * i;
alpha[49-i] = (49-i) * 3;
}
Forum: C++ Dec 27th, 2007
Replies: 30
Views: 2,899
Posted By invisal
Of course. If I were you, I would seperate the code into 3 files: stack.h, queue.h, and main.cpp
Forum: C++ Dec 27th, 2007
Replies: 30
Views: 2,899
Posted By invisal
Salem's avatar told you all about it.


#include<conio.h>
#include<stdio.h>

You are using C header files rather than C++ header files.
Forum: C++ Dec 27th, 2007
Replies: 30
Views: 2,899
Posted By invisal
void main()
{ intro();
menu();
}

Non-standard code.
Forum: C++ Dec 26th, 2007
Replies: 30
Views: 2,899
Posted By invisal
Don't worry, I would never comment that much in my project, and the comments look nicer in gray colour than in green colour.
Forum: C++ Dec 26th, 2007
Replies: 30
Views: 2,899
Posted By invisal
I know that my code is over-commented; however it is very self-documented.
Forum: C++ Dec 26th, 2007
Replies: 30
Views: 2,899
Posted By invisal
Self-document code is not only comments what the code does but also the concept of the code. To give you an idea of how to comment, I write a small example of code with comments. (I'm not a...
Forum: C++ Dec 26th, 2007
Replies: 11
Views: 1,736
Posted By invisal
It depends; the bigger the number is, the faster the running till sqrt(n) perform. Another thing, all the prime number, except number 2 and 3, are in this format 6k+1 or 6k-1; however, not all the...
Forum: C++ Dec 26th, 2007
Replies: 11
Views: 1,736
Posted By invisal
Why make your code so complicated? The most basic concept of finding prime is to test from 2 until number-1. Once you find the divisor number of that number, then you are also able to find the factor...
Forum: C++ Dec 25th, 2007
Replies: 4
Views: 590
Posted By invisal
More comments are needed to be added.


/*********************************
* What is the title of your program? *
* What is the purpose of this program?*
* Written by who? ...
Forum: C++ Dec 24th, 2007
Replies: 5
Solved: function
Views: 860
Posted By invisal
#include<iostream>

float celsius_to_fahrenheit(float);
int main()
{
float fahrenheit;
float celsius=22.5;
fahrenheit=celsius_to_fahrenheit(celsius);...
Showing results 1 to 40 of 44

 


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

©2003 - 2009 DaniWeb® LLC