rahul8590 71 Posting Whiz

well i do know something about face recognition , but i am pretty sure its not using neural networks, it was implemented with the concept of mathematics commonly know as eigen values n vectors .well at the first place u must know neural networks in depth to do that and image processing.
well try learning these things , ur project is the last obstacle of all these paths of knowledge so u gotta a lot of homework to do.

rahul8590 71 Posting Whiz

search for records in a struct.

well you have vaguely mentioned the problem.please tell the various data members in structure , the one whos content is unique (like roll no , employee id etc ) for all objects of struct could be easy to use as the search element .

rahul8590 71 Posting Whiz

well both kinda do the same job . i thought it was better to approach from atomic level .

rahul8590 71 Posting Whiz

at the line number 57 of ur s or where ever the operation on array is happening (usually at the iterations ) . write a print array function and pass the array to the function . thus after each operation the array manipulations will be displayed , thus enlightening the user about each iteration.

rahul8590 71 Posting Whiz

well to split the number is very easy task.
firtly you divide the number by 10 . and then myltiply the number by 10.
(you will not get the same number since you are using int data type)

int x = 85;
int y = x/10;              //here value of y is 8.
y *= 10;                // the value of y becomes 80
int z = x - y;            // value of z is 5 . which is at units place of original number

thus int y has the tens digit place and int z has units digit place.


after splitting the two numbers , pass them as parameter to ur function and you will get the desire result

rahul8590 71 Posting Whiz
while(ordnum != 99999);

if you put a semi colon at the end of while loop that means the loop doesnt have ne statements incorporated in them .

rahul8590 71 Posting Whiz

seems like you haven't even tried to solve a problem .
we are not here to do your homework.

rahul8590 71 Posting Whiz

Yes I have already mentioned that k2k can run their program as an applet. Do you know of any way that a java application (ie not an applet) can be run from an HTML link?

well actually i used to convert all of my code in an applet form and work. but if u completely wanna run java application using html then try the underneath link .
http://www.java2html.com/
it converts the java code to html .

does it mean my main html file should have a link, linking to another "html file in java format" and must extend to applet?

if it doesn't take too long, would you mind to give a simple example of the java program? maybe just the necessary heading and stuffs, so it would be easier for me to see the first time doing this.

well i cannot write a complete program , but yeah since you have requested i can write a simple one.

import java.awt.*;
import java.applet.*;
/* <applet code = "me" height = 300 width = 300 >
</applet code> */
public class me extends applet 
{
public void paint (Graphics g)
{
 g.drawString("hi",25,25);
}
}

well honestly i havent compiled the code , but to the best of my knowledge it must work .

rahul8590 71 Posting Whiz

well i am working on program which
inputs :
1. student record (name , semester , class , branch , roll no )
2. the various subjects on which the exam to be held
3. the date on which the subject s exam to be held

the data which is already feed in :
1. the number of classrooms
2.each classrooms capacity

the desired ouput :
well the program is supposed to allocated a set of students (irrespective of branches ) in a classroom and make sure that two people of the same branch, semester should not sit together.

well i have inputted the student record using visdata (which VB already has it).

i am not able to frame a logic on how to proceed further .
i mean how to randomize the allocation of seats so that same branch people never sit together .

i would be glad if you could suggest me any other ingenious ideas.

rahul8590 71 Posting Whiz

well in ur java program u will have to write the following

/* <applet code = "filename"  height = 300 width = 300 >
   </applet code> */

it should be written after the packages you import (i usually write at that position ). you can change height and width accordingly.
and you have to write like writing comments cuz java compiler doesnt understand that particular tagged code

and then save the file in .html form . i guess it should work
or else in the command mode you can use appletviewer

rahul8590 71 Posting Whiz

Hello, I have a question, when does a global variable get destructed?

well i guess when the program terminates , the global variable is freed by the OS .

rahul8590 71 Posting Whiz

The person must be working with a 'magical' compiler. Since no standard compiler allow you to use iostream.h with namespaces. If you are using namespaces, you must use the iostream and not iostream.h

may be in your neighborhood . but you see not all have grown up from there .
well it might give you a warning . may be a bad practice . but surely it compiles and fetches the right output .

As far as your code is concerned, it is clear that you have not compiled the program.

well seems like person is loathed with overconfidence.when i write post i write with utmost honesty .

rahul8590 71 Posting Whiz

He mentions needing to use a for loop, not recursion. At least that is how I took it.

well i can directly give him the code , great deal . but wats the point he wont learn anything by that . at least by giving him the recursion one i have made is job easier to think . all that he has to do is to convert the recursion to iterative format .

rahul8590 71 Posting Whiz

Wrong, look here ...

well i guess pal , u need to see her problem mentioned . she could nt display some elements , she never mentioned about error caused by namespace.now why would you assume that ...?

rahul8590 71 Posting Whiz

This code won't compile. You cannot use namespace with old c++ library (iostream.h).
Drop the second line of your code or use iostream instead of iostream.h

since the person itself has written the code using namepace . i assume that she is working on gcc compiler ,not the old tatted turbo c . thus there isnt any thing wrong with the code i have mentioned .

rahul8590 71 Posting Whiz

in your code at the first place use void accept() and void display ()
these two functions are not returning any integer values so why use int data type for them .

#include<iostream.h>
using namespace std;

class furniture

{

        protected:

                float width, height;
                char color[10];

};


class bookshelf : public furniture

{

        private:

                int no_of_shelves;

        public:

        void accept() {

                cout<<"enter color"<<endl;
                cin>>color;

                cout<<"enter width"<<endl;
                cin>>width;

                cout<<"enter height"<<endl;
                cin>>height;

                cout<<"enter no of shelves"<<endl;
                cin>>no_of_shelves;

                }


        void display() {

                cout<<"color is "<<color<<endl;
                cout<<"width is "<<width<<endl;
                cout<<"hegiht is "<<height<<endl;
                cout<<" no of shelevs is "<<no_of_shelves<<endl;

                }
        };

int main() {

        bookshelf b;
        b.accept();
        b.display();
        }

i have changed the width and height to be in float so that they can have better accuracy .

rahul8590 71 Posting Whiz

well at first place i would like you to do the problem from the easy level . by this i mean its better to first just accept the numbers and then do the job you want to do and then add ne amount of sophistication you want to add.

rahul8590 71 Posting Whiz
rahul8590 71 Posting Whiz

well if ur a neophyte into this then the oly thing i recommend is ti do the program from basic
1. using char array . later on you can re do the same thing with utmost sophistication . sometimes simplicity is the best thing .

rahul8590 71 Posting Whiz

well trust me pal , there is nothing like assembly .
assembly is the mother of all languages . there s nothing fast enough liike this besides , its good to be very close to machine and know assembly .
if u leave this i would feel guilty that its because of me pal ,
i am ready to help you in all ways i can , so dont loose hop .
remember
"hope is a good thing , and good thing never dies "

rahul8590 71 Posting Whiz

char[] characters = Text.toCharArray();

wat is "text" here , i mean wat does it hold .
besides u could have been a little more explicit in mentioning about your code .

as far as i guess from this its a mismatch between string and char data type .
why dont u first try keeping all the data type as same preferably char and then solve it , ur job will be a lot more easier n then you can go ahead doing using string n char types .

rahul8590 71 Posting Whiz

well let me simply for you ..

1. accept number(`s in form of for loop or so ) and perfrom step 1 of my previous post .
you will land up with alll the divisors of that particular number (which will be the current number of for loop ) .
store it in some kinda array .

2. now check the summation of these numbers (which are divisors of the number inputted). if the add up to the number which is inputted , then the number which is inputted is perfect .

now re run the for loop and find such first 4 perfect numbers

rahul8590 71 Posting Whiz

sorry for late reply

Errr... I have installed TASM, but i got no idea how to work with it.

well if u have done a conventional installation that is installing in c drive. there must be a folder called TASM must be created
most imp searchfor two files mainly
1. tasm
2.tlink

these are the basic files (well a lot more are needed ) .

well to work with tasm its very simple

1. create (.asm) file and write ur assembly code
2. tasm filename.asm (type this in dos)
it will create an (.obj) file provided if there arent any errors .
if errors exist it will tell with the line numbers

3. tlink filename.obj
this will create an exe version of the file

4.filename thats it , since its exe it will excecute itself

i guess this should do , if something un usual happens let me know

rahul8590 71 Posting Whiz

well in class the data members and functions are taken in as private by default by the compiler itself , unless u explicit mention that.

rahul8590 71 Posting Whiz

well u can store the effective address of the array in stack pointer or DI .
then u can use the instruction
repe cmpsb ; this instruction will jmp to label1 if two words arent
;equal or it will jump to label1
jne label1
jmp label2

rahul8590 71 Posting Whiz

well did u try that in tasm ....? that is the turbo assembler . (its kinda preferred )

rahul8590 71 Posting Whiz

well i have written the program in tasm and it works fine .
the programmin stlye is a bit different but i guess u can undestand

.model small
.stack 40
.data

str1 db 50 dup('$')
msg db 10,13, 'enter the str1ing : $'
disp db 10,13, 'displaying the str1ing : $'

.code

mov ax,@data
mov ds,ax
lea dx,msg
mov ah,09h
int 21h
 lea si,str1    ; making si to hold the starting address
xor cx,cx    ; clearing cx register


lp:
mov ah , 01h   ; the first two lines are to read from keyyboard
int 21h
cmp al 0dh    ; compares until we press enter character
jz stop
mov [si] , al    ; if enter key  is not pressed contents are stored in
inc si              ; string and si is incremented
inc cx
jmp lp

stop:
lea dx , disp  
mov ah,09h
int 21h
lea si , str1

lpz:
mov dl , [si]
mov ah , 02h   ; the first two lines displays the data
int 21h
inc si
dec cx
jnz lpz
mov ah,4ch
int 21h

end

i guess this should do the trick .

rahul8590 71 Posting Whiz

well why dont you try tasm (mostly doesnt disappoint ) .
besides why dont u try the following code

.model small
.stack
.data
       str  db "Welcome to assembly $"
.code
          mov ax , @data
          mov ds , ax     ; gets data to data segment
          lea dx , str      ; laods effictive address of str in dx reg
          mov  ah , 09h  ; calls for display
          int 21h
          mov ah , 4ch   ; ends sub - routine 
          int 21h
end

i wold like to know whether this program works o your system or not its just a simple program to display the string content

rahul8590 71 Posting Whiz

What are inline functions?

Functions that the compiler knows to optimize. I think most compiler usually figure out what to inline by themselves these days.

i would like to append a little more information .
first of this terminology is very much used for functions in classes .
if a particular function is defined inside the class itself it becomes inline .
that is usually if a function is defined and called for the compiler navigates to the part where its defined and then executes the instruction . but if its an inline function the code which define the function as a whole is taken in , rather than navigating to it.
thus by speeding up the execution .

Note : inline functions have to be smaller (lesser lines of code) .its prudent not to make huge functions inline .

rahul8590 71 Posting Whiz

I have a question I did not understand if anyone of you understood it please explain to me

suppose that m and n are integers and m is nonzero. Recall that m is called a divisor of n if n=mt for some integer t; that is, when m divides n, the remainder is 0. moreover .m is called a proper divisor of n if m<n and m divides n. a positive integer is called perfect if it is the sum of its positive proper divisors. for example, the positive proper divisors of 28 are 1,2,4,7 and 14 and 1+2+4+7=28. therefore 28 is perfect. write a program that does the following;
a.output the first four perfect integers.
b.takes as input a positive integer and then outputs whether the integer is perfect.

and thank you a lot

well ur inputted with a number for ex lets take the no 28 ( which is in ur ex)
1. (this one is for proper divisor )
u will have to find such nos that divide 28 completely i.e
28 % number = = 0
the remainder must be zero
thus you will land up in 1 , 2, 4, 7 , 14

2. then when u find these numbers , u will have to find the summation of these in such a manner that
their sum is equal to 28
i.e in this case 1+2+4+7+14 = 28

thus the number 28 becomes perfect positive number .

rahul8590 71 Posting Whiz

I am having a lot of trouble trying to get the toUpperCase method working. I have basically put a String of text into a character array and I want to convert a certain character in a certain place in the String to uppercase.

well i doubt that u can do that simultaneously . well if u want to find a particular character and then replace or replace at particular position .

1. input the string
string s = new string ("text");

2.convert the string to char array
char s1[] = new char[4];
s1 = s.toCharArray();

3. iterate using the character array and change the character u want to

4. covert the character to string
s = s1.toString();

then i guess u can re print the string.

rahul8590 71 Posting Whiz

ok pal i forgot to add etc etc in previous post .

rahul8590 71 Posting Whiz

well even i am into image processing and this link helpmed me a lot .
i dont know how far it will help you .
http://cimg.sourceforge.net/

rahul8590 71 Posting Whiz

well integers in java can hold a lot bigger values than that infact if i am not wrong its even bigger than the one allocated in c/c++.
well if u still want bigger values then try using float or double.

rahul8590 71 Posting Whiz

well i follow the approach of analysis and then design and finally robustness of the code . that makes things easier . and skipping these basic fundamentals will create a lot of confusion n frustration .

rahul8590 71 Posting Whiz

all you can do it to solve using a recursive manner

int fact(int n)
{
if(n==1)
return 1;
else
return (n*fact(n-1));
}

well this solves the major issue . now all u have to do is to fit the bits of code and put them together .

rahul8590 71 Posting Whiz

well i kinda didnt undestand ur problem
wat does the following mean

You should process all pairs of integers and for each pair determine the maximum cycle length over all integers between and including i and j.

if u could be a little more explicit about it , i think we can work it out.

besides to input pair u can create a class
like

class   abc
{
          float i ,j;
          float maxlen ;
          public :
          abc()
          {   i=j=0;
          }
          void maxlen ()
          {
          --------------------
           ----------------
           }
            void disp ()
           {
            cout<<i<<setw(5)<<j<<setw(5)<<maxlen;
           }

};

void main ()
{
       abc a[100] ; // or how many ever pair of nos u want 
                         // then accept those pair of nos using for loop
                         // at same time call the maxlen function which 
                         // calculates watever u want( srry couldnt    undestand that part )
                       // then all that u have to do is display 
}

well i guess this can give you a rough idea .

rahul8590 71 Posting Whiz

yes i have ran it and it works fine .
thanks for improving my code .well i knew it could also have been done in a shorter way than i did , its just that i wanted to be very comfortable with wat i was coding with .

rahul8590 71 Posting Whiz

by come out of loop i meant the if condition wont execute

if( i %j ! = 0 )
a.add(i);

if none of the nos are divisible other than itself and one its a prime no
i.e if the "if condition" satisfies (please re look at my code again) then only the number is added in array.or else the next iteration is done .

rahul8590 71 Posting Whiz

well thanks for being so concerned . i am on my way on installing the new version (hopefully the new one ) . thanks for help

rahul8590 71 Posting Whiz

Well u have understood me wrongly......
at the frist place i have checked the program and it works fine .
for 9 it will check 9 % 3 which is very much divisible . thus it will come out the loop .and not add into the array

rahul8590 71 Posting Whiz

yeah finally got it ... i have checked it (but not rigorously ) and its working .

public class NewClass {
 public static void main (String [] args)
 {
     String str1 = new String("madame");
     int l,l1;
     boolean b = true ;
     char c1,c2;
     l1 = l = str1.length();          
     //l1 = str1.length();
     for ( int i=0;i<l1 ; i++)
     {
         c1 = str1.charAt(i);
         c2 = str1.charAt(l-1);
             if(c1 != c2)
             {      System.out.println("not a palindrome");
                 b = false ; 
                  break;  
             }
         l--;
     }
 if(b == true)
       System.out.println(" palindrome");
     
      
 
 }
}

i guess this should do ...

rahul8590 71 Posting Whiz

Hi all
What if we counts the divisors?If more or less as 2 then Not prime else if exactly 2 then prime...(only 1 and itself)
Like in pascal there is a function Mod always return the reminder(s), and if the function returns 0 the the counter variable increasing by 1.In the pascal snippets I wrote a little program that writes the prime and not prime numbers from 0 to 100.The method is that I count the divisors' numbers....
Sorry I'm just knowing the pascal a bit...:)

Well thats the most lousy way of programming . why take a 5 mile road to reach ur neighborhood .

rahul8590 71 Posting Whiz

ohh. its that easy ..
well since i have already a dual os , i guess it will not create ne problems .

rahul8590 71 Posting Whiz

wold be glad if you could be a little more explicit in telling , how to do it ...?

rahul8590 71 Posting Whiz

Well , i didnt think of run time at the first place , i just thought of logic . but instead of checking for Math.sqrt() u can actually check till "i/2" in the "j" iteration loop , i guess that will save more time . (do that in the original code i wrote) . i would be glad if you could check and compare the time of execution .

rahul8590 71 Posting Whiz

Well prime nos re those which are divisible by 1 or by themsleves only.


Well ur code should be something like this

assuming the range to be like 100 .

ArrayList<Integer> a = new ArrayList<Integer> ();
int range =100 ;
a.add(2);
a.add(3);
for(int i= 4 ; i<range ; i++)
{
       for( int j = 2 ;j <i ; j++)
       {
               if( i %j ! = 0 )
                 a.add(i);
        }
}         
  
System.out.println( " the list of prime nos are " + a);

i think this should do , well i would be glad if you could run the code

rahul8590 71 Posting Whiz

Thank you Rahul. I appreciate you taking the time to help me out. I don't think I know how to convert that code to what I need. Heck, I don't even know how to write what I need, lol! Oh well I guess I need to do some more research!

well its my pleasure , i am always fanatic about programming .
Well actually technically there isnt any thing called convert the code , its just that i had intially learned c++ in a traditional style which is outdated now (that does not mean that the code doesnt work ) , its just that the new way of programming delivers more Object oriented programming rather than the traditional one .


well technical the method here i have given is the one i have mentioned before .
the code works perfectly fine . nothing wrong as far as i know , but may be a bit amateur compared to the one i have given initially.

as i said before .

1. i have accepted the length of the string .
2. created a dynamic stack / space to hold the content of string .
3. as i am accepting the string i am alos pushing that into stack .
4. then i am running an iterative loop where i am checking the string from the beginning and also popping the elements from the stack .
5. if there exist any …

rahul8590 71 Posting Whiz

thanks pal that was very helpful .

rahul8590 71 Posting Whiz

well i have written the stack version of the code , but the code is in traditional sense , i guess you can convert it into ur style of programming .

#include<iostream.h>

char *stack;
int top=-1;
void push ( char c)
{
	stack[++top] = c;
}

char pop( )
{
return (stack[top--]);
}
int main ()
{
char *str;
int len,check=0,i;
cout<<" enter the length of string ";
cin>>len;
stack = str = new char[len];
cout<<"enter the string";
for( i=0;i<len;i++)
{cin>>str[i];
push(str[i]);
}


for (i=0;i<len;i++)
{

	if(str[i] != pop())
	 {
	     check=1;
	     cout<<"not palindrome";
	     break;
	 }
}

if (check == 0)
cout<<" palindrome";
return 0;
}

Well it functions like a stack n i have mentioned the push and pop actions also. the only trouble is that u will have to press enter after entering each character of the string .