Search Results

Showing results 1 to 40 of 40
Search took 0.01 seconds.
Search: Posts Made By: hammerhead
Forum: C++ May 15th, 2008
Replies: 10
Views: 773
Posted By hammerhead
For two matrices to be equal, the dimensions of both matrices have to be equal and the corresponding values should also be equal. I would follow niek_e's method to compare two matrices.
Forum: Geeks' Lounge May 15th, 2008
Replies: 25
Views: 3,586
Posted By hammerhead
I dont know if it can be classified as anime or not, but I like Avatar.
Forum: C++ May 13th, 2008
Replies: 4
Views: 551
Posted By hammerhead
Insert line 20 inside the while loop and add the statement prev=prev->link; at the end of the loop.
Forum: Computer Science May 11th, 2008
Replies: 7
Views: 1,598
Posted By hammerhead
Take a good book on computer architecture and start reading, once you have finished a chapter start reading the refrences given at the end of the chapter. Most of them will be papers from IEEE or ACM...
Forum: C++ May 11th, 2008
Replies: 7
Views: 923
Posted By hammerhead
An alternative could be using link list if you want to do it without STL. That way your first issue would be solved, but still the best way would be using vectors.
Forum: Geeks' Lounge May 7th, 2008
Replies: 47
Views: 4,599
Posted By hammerhead
Spend the day adventure sporting with my friends.


40C here and I am burning :(
Forum: C++ May 1st, 2008
Replies: 15
Solved: Mirror Numbers
Views: 1,282
Posted By hammerhead
You are not using your head and instead simply copy pasting the code. If you had read any of the posts above the mistake in my code would have been clear to you.
Forum: C++ May 1st, 2008
Replies: 15
Solved: Mirror Numbers
Views: 1,282
Posted By hammerhead
number1 = number % 10;
number=number/10;
number2 = number % 10;
number=number/10;
number3 = number % 10;
Forum: C++ May 1st, 2008
Replies: 15
Solved: Mirror Numbers
Views: 1,282
Posted By hammerhead
No you are not. The base of the numbers is 10 not 100 or 1000. And you have used cout the wrong way


cout << endl << number<< number2<<number3;
Forum: C++ May 1st, 2008
Replies: 15
Solved: Mirror Numbers
Views: 1,282
Posted By hammerhead
A hint, divide a number by 10. The quotient would be the number except for the least significant digit and the remainder would be the least significant digit. Use these two in combination to get your...
Forum: C++ Apr 27th, 2008
Replies: 26
Views: 2,097
Posted By hammerhead
I am not sure, it has worked for me and I have never bothered to search. I will leave it for more experienced programmers to answer your question.
Forum: C++ Apr 27th, 2008
Replies: 26
Views: 2,097
Posted By hammerhead
There is no need to use floor() as int truncates any decimal place as it is.

for any 4 digit number this should do the trick to extract all 4 digits

i=0;
while(number>0)
{
a[i]=number%10;...
Forum: C++ Apr 27th, 2008
Replies: 26
Views: 2,097
Posted By hammerhead
Its not

cin >> number,first,second,third,fourth;


but

cin >> number>>first>>second>>third>>fourth;
Forum: C++ Apr 26th, 2008
Replies: 8
Views: 692
Posted By hammerhead
I dont mind being called a geek because that is more or less what I am :)

Note that the '==' operator does not apply to float. You would get the output as C++ if you tried

if(f==.7)
Forum: C++ Apr 26th, 2008
Replies: 27
Views: 3,837
Posted By hammerhead
The formula can be generalized as

index= ((row_num-1)*3) + (col_num-1)

where index is the index in the array
row_num is the row number of the element you want to refer and
col_num is the...
Forum: Windows NT / 2000 / XP Apr 25th, 2008
Replies: 11
Solved: disk space
Views: 1,269
Posted By hammerhead
Hi James

Right click on My Computer and select Manage. On the left select disk management and select your drive. On the unallocated partition, right click and select format. You will have options...
Forum: Windows NT / 2000 / XP Apr 25th, 2008
Replies: 11
Solved: disk space
Views: 1,269
Posted By hammerhead
Format the partitions from disk management in either FAT32 or NTFS.
Forum: C++ Apr 25th, 2008
Replies: 1
Views: 457
Posted By hammerhead
for(int i=countDown;i>=0;i-- )
Forum: C++ Apr 25th, 2008
Replies: 27
Views: 3,837
Posted By hammerhead
Number of colums in the first matrix have to be equal to the number of rows in the second one. If you have only a row or a column matrix i.e. two arrays, their lengths have to be equal in order for...
Forum: C++ Apr 24th, 2008
Replies: 14
Solved: hcf and lcm
Views: 4,250
Posted By hammerhead
Also note how m and n get interchanged if n>m, consider the case of m=6 and n=15

r1=6 MOD 15 = 6

m<-n implies m=15
n<-r implies n=6

the process is repeated to get gcd as 3
Forum: C++ Apr 24th, 2008
Replies: 14
Solved: hcf and lcm
Views: 4,250
Posted By hammerhead
LCM is the tricky one. One needs to know that every number greater than 1 can be represented as products of prime numbers. Once factors each number m,n into its corresponding prime factors and then...
Forum: C++ Apr 24th, 2008
Replies: 14
Solved: hcf and lcm
Views: 4,250
Posted By hammerhead
Okay here is the pseudo code for hcf, credit to Euclid.

gcd(m,n)

r<-(m MOD n);
if r=0 then
{ return n }
else
{
m<-n
Forum: Windows NT / 2000 / XP Apr 20th, 2008
Replies: 6
Views: 882
Posted By hammerhead
Are you using a dhcp to assign ip's to your ethernet card? What is your isp? Also if you are using pppoe make sure that your username and password are correct :P
Forum: C++ Apr 17th, 2008
Replies: 9
Views: 1,231
Posted By hammerhead
Or maybe


arr1 = 3 0 0 5 size=4
arr2= 3 0 5 size=3

// array sol of size 5 here


then we need the array solution as size 4+1. It will still be simulation...
Forum: C++ Apr 16th, 2008
Replies: 8
Views: 520
Posted By hammerhead
For this you can do what Ancient Dragon said and find out the maximum/minimum value and then traverse the array once again and compare each element with the maximim/minimum value, if it is equal then...
Forum: C++ Apr 14th, 2008
Replies: 7
Views: 524
Posted By hammerhead
In the above loop you would have to check for every i if it is odd or not using

if(i%2!=0)


alternatively you could use i=i-2 instead of i-- and simply display the numbers.
Forum: C++ Apr 11th, 2008
Replies: 6
Views: 2,648
Posted By hammerhead
There is a strrev() function in string.h for char array. I dont know enough to help you with your code but I suggest you to follow a different method for checking palindrome in a string.

Instead...
Forum: C++ Apr 10th, 2008
Replies: 4
Solved: quick question
Views: 395
Posted By hammerhead
I dont know what you are trying to do but in line 12 during the last iteration of the loop i=4, i+1 will be 5 that will go out of bounds for the array pass. Run the loop till i<4 because there will...
Forum: C++ Apr 9th, 2008
Replies: 3
Solved: 2-D Arrays
Views: 505
Posted By hammerhead
At line 7 when the loop ends, f will be 10. You are simply multiplying 1*10 and storing it in result. You can make result an array of size 10 then use

result[f-1]=k*f;
Forum: C++ Mar 23rd, 2008
Replies: 8
Solved: How to do this?
Views: 982
Posted By hammerhead
If you want to do it by using regular expressions you would need a lexical analyzer. For C/C++ lex is usually used. Here is a tutorial page
http://dinosaur.compilertools.net/lex/index.html

as for...
Forum: Geeks' Lounge Mar 23rd, 2008
Replies: 23
Views: 2,706
Posted By hammerhead
Tennis, sleeping and movies.
Forum: C Mar 12th, 2008
Replies: 12
Views: 1,913
Posted By hammerhead
Factorial of any number greater than 5 ends with a zero. For a larger number, the number of zeroes at the end constitute a large part of the number. If you can eliminate those zeroes it will help.
...
Forum: C++ Feb 28th, 2008
Replies: 16
Views: 1,240
Posted By hammerhead
Oops correction
f(209)=f(f(20)+9)=f(f(f(2)+0)+9))=f(f(2)+9)=f(11)=f(1)+1=2

So many f's . But again I might be wrong again :) . I havnt tested it for values where sum of the digits is a number of...
Forum: C Feb 28th, 2008
Replies: 2
Views: 1,060
Posted By hammerhead
Use else if statement. According to your code, if a=0 and b=0 then both the first and the second if statements will be executed. And the output will be
"There are no solutions"
"There is one...
Forum: C++ Feb 28th, 2008
Replies: 16
Views: 1,240
Posted By hammerhead
From the test cases I used, the code was working fine (till the max value of int) . I usually write down a mathematical expression before coding it. The function for sum of the digits of a whole...
Forum: C++ Feb 28th, 2008
Replies: 16
Views: 1,240
Posted By hammerhead
Okay here is another shorter alternative.

#include<iostream.h>

int eig(int num)
{

if(num<10)
{
return num;
Forum: C++ Feb 28th, 2008
Replies: 16
Views: 1,240
Posted By hammerhead
Okay I made this code on Turbo C

#include<iostream.h>

int eig(int num)
{

if(num<10)
{
return num;
Forum: C++ Feb 27th, 2008
Replies: 4
Views: 8,906
Posted By hammerhead
From what I remember of my coordinate geometry, testing for a point inside a triangle wasnt easy. Try this
http://mathworld.wolfram.com/TrianglePointPicking.html

you might have to translate one...
Forum: Geeks' Lounge Feb 27th, 2008
Replies: 15
Views: 1,724
Posted By hammerhead
I am presently working on emulation of human movements through robotics as my college project.
Forum: C Jan 21st, 2007
Replies: 10
Solved: a moving object
Views: 2,034
Posted By hammerhead
You can clear the entire screen using the cleardevice() function and redraw the square in a loop with the new positions.
Showing results 1 to 40 of 40

 


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

©2003 - 2009 DaniWeb® LLC