rahul8590 71 Posting Whiz

Well even if u have to use stacks i dont think u need three stacks .
Well u can do something like this .
just create one stack where the elements of the string is pushed.
then pop the elements of the stack and check with the elements of the string itself . if there s any kind of mismatch print not palindrome and break of .

Well the code which i have mentioned earlier works perfectly fine .
i can still write the stack version of it , the only problem is that my code is very traditional and kinda outdated (but still will work ) compared to this new style of programming.

rahul8590 71 Posting Whiz

Well at the first place if ur assignment has only said palindrome program , then i find no reason to use stack . all u got to do is to iterate from first and last at the same time and check the characters . rather than pushing in some stack and then popping it all . u will have unnecessary extra code which can be reduced to a larger extend .

rahul8590 71 Posting Whiz

Well finally i got it .. i know nothing great in the program its just i am new to this style of programming.
Well the following is the code

#include <iostream>
#include <string>
using namespace std;

int main ()
{
  string str ;
   int i =0;
   getline ( cin , str);
  string::reverse_iterator rit;
  string::iterator it;
  for ( rit=str.rbegin() ,it=str.begin(); rit < str.rend() && it < str.end(); rit++ ,it++)
  {  if( *rit!= *it)
    {cout<<" not palindrome";
        i=1;
        break;
  }

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

well i tried it and it works fine . i would be glad if u could make it still better .

rahul8590 71 Posting Whiz

Well i got fedora 8 distro and want to install it on fedora 7 ,Well at the first place is there any room for that ?
well if it is then how can we do it ?

rahul8590 71 Posting Whiz

yeah thats there but , like linux if you have to fetch details of any command u usally use the man command which completely tells you about the command ur looking for , thus everything can be searched under one hood.
isnt there any thing like this , i mean a database or so which keep record of all the header files `s operators and functions ...?

rahul8590 71 Posting Whiz

Well in computer architectures , the newer versions have new technology appended to the older ones .
so if ur programming 8086 on an intel core 2 duo processor , it would still work (but the vice - verse will not ) , its just the size of the registers and their no changes but the primary architecture still remains the same .
well the above i said assuming that intel pc s are used .
well as far as i know it may/maynot work for motorola or IBM pc `s .

rahul8590 71 Posting Whiz

Well the best book as far as i have know is
Assembly language step by step - jeff duntemann
he teaches you from the scratch.
well after reading the whole book if u still want to develop more insight into it , then i guess u can go in for
Mastering Turbo Assembler by - Tom Swan

these r the ones i liked the most.

rahul8590 71 Posting Whiz

Well i just want to find out , that is there any way where we can find out the various functions and operators / keywords present in a particular header file ....?

rahul8590 71 Posting Whiz

well at the first place i would recommend usage of float data type instead on double , guess float would do the trick.
second of all subtract the left part of the no from the original no itself , by doin this u can isolate the decimal part and then if u r looking for a 3 decimal round off in all the nos ( which apparently is ) .
u can multiply the 3 digits decimal into 100 and then round of them

float round( float no )
{
     int x, temp;
     float y;
     temp = x = no ;   only the integer part is taken 
     y = no -  x ; u get the decimal number here 
     y*=100 ; decimal gets converted to 2 digit no n 1 decimal
     x = y;
     y-= x;  the last decimal is stored in y 
     if( y > = 0.5 )
             x++ ;
    return (temp + x/100) ;
}

well i would like you to dry run the code .

songweaver commented: very helpful +1
rahul8590 71 Posting Whiz

well at first i completyl apologise cuz when i saw the thread , i actually didnt navigate thru the forum section , so just mistook as c form

second of all

Ouch, you are in a different world! That looks like old, ugly, and badly written C code.

well even though its a c code , i dont see any kind of ugliness in the code.i am glad if u could be specific in pointing out the so called
"old, ugly, and badly" in the code.

rahul8590 71 Posting Whiz

well actually i landed up on this program when i was working on high performance computing applications. and other programs which can work on parallel machines and finally i thought such massive huge data of coordinated can be parallelized and thus solved . well i would love to hear more about machine learning .

rahul8590 71 Posting Whiz

well sorry for that , its just that i was solving math n wondered if i could program that , n honestly at that moment it felt very easy.
i would definitely work on it.

thanks

rahul8590 71 Posting Whiz

well definetly yes .

well its a statistical problem . i just thought if a given set of coordinated are given , i could predict them how much further they can be extended and find a suitable equation which represents the stuff.
well i could nt show the code for the reason is that its very nasty and brain storming to even undestand wat i am doing in it (although its a piece of mess , so i thought it would be prudent not to show it).
well i would be glad if i am let to know what exactly its called , i mean it must have a technical name for it.

rahul8590 71 Posting Whiz

i guess this should do the trick...

int leap ( int int x)
{
                       if  (!(x%100) && ( x %400 || x %4))
                                     return 1;
 }

well it will return 1 if the year is leap year or not

rahul8590 71 Posting Whiz

Hey every one ,
well i was writing program which inputs "Statistical data for example
x 1 2 3 4 5
y 1 4 9 16 25
and analysing the data my program must suggest a suitable algebraic equations like looking at this one it should tell me the equation ins y = x square
"

Well wat i have done is i have written different cases like
y = x square
y = log x and so on
but i guess its a very bad style of programming . i would be glad if you guys help me out in suggesting ingenious ways in doing it .

note: "well i know u guys will be a little skeptical about it . but honestly its not my school work or any thing similar to that .

rahul8590 71 Posting Whiz

i guess some properties of the vitrual functions like run - time binding arent there in constructors , Nevertheless syntactically they cannot created.

rahul8590 71 Posting Whiz

ok SORRY i totally apologies for using ne instead of using any and in future stuff like this will never happen ,atleast not from my side.

rahul8590 71 Posting Whiz

Well there r lot of things i didnt know.
finally coming to the conclusion that , i must build linux from scratch to fetch these concepts thanks Stylish.

rahul8590 71 Posting Whiz

>at the end of the code just write
>getch();
And also include <conio.h>, not forgetting that the conio library functions are absolutely non-standard and your code won't work on many compilers.

Well the problem clearly mentioned "Turbo C++ IDE 3.0 " thus in that environment <conio.h> header file very much exist. it would be convenient to use it.

Is it really that much work to type "any" instead of "ne"? If you're sloppy when communicating, most people will assume you're sloppy in everything else. You lose credibility even before your technical accuracy is examined.

Well by writing ne instead of any doesnt show any kind of sloppiness by any means . both the word sound the same so its easier to write thats it .

rahul8590 71 Posting Whiz

well usually the line no will be put in () brakets like these besides the error like :

Extra charaters in line (32) : -some text here -

the no in the brackets are usally the line no .i work in MASM . which is ur assembler. ?

rahul8590 71 Posting Whiz

at the end of the code just write

getch();

then you can only exit the output after pressing ne character.

rahul8590 71 Posting Whiz

Well correct me if i am wrong .
asser macro aborts from the program not exits . there is a subtle difference btw them . the former i guess exits without performing any task . but the latter i guess has a safer exit.


well if u want to abstain ur self from exit i guess u can turn ur code something like this

int cmp (int a , int b)
{
     return(a!=b);
}

and in main function
if(cmp(a,b))
      cout<<"both r not equal";

i guess this should work

rahul8590 71 Posting Whiz

well ur guess is absolutly right . i have so much insisted on usage of code blocks , but the fact is no one listens to me so i took the liberty on working with code blocks myself. so i find it a bit difficult getting adjusted to the iso c++ cuz it doesnt allow so many things.
i would be glad if you could recommend a book especially a person like me who was worked in c++ for like 2.5 yrs but only on the ancient compiler .

rahul8590 71 Posting Whiz

Well assert is a macro that expands to if statement .
if the test value is zero assert prints the message to stderr:

if the test fails :
test , filename , line linenum is printed .
linenum is the line where the macro is used

well it depends on a persons usage that were exactly he has to use.
if u want to check some no (which might be a passwd) then use assert function . cuz if it fails the program is aborted.
but u want to perform conventional check then its prudent to use the if statements .

rahul8590 71 Posting Whiz

Well flux123 i dont pretend to be an expert in this assembly programming but have some tricks of my own
1. its better to use TASM cuz it excecutes both the styles of programming.

2. instead of pushing the string into the stack its better to store it in a variable

the program code is below , i have excecuted in tasm n it works perfectly fine

.model small
.stack
.data
        str   db  50 dup('$')   ; for storing string
        msg db 10,13,"enter the string : $"
        dis   db 10,13,"The string entered is :$"

.code
       Mov ax , @data
       Mov ds , ax
       LEA dx , msg
       mov ah , 09h
      int 21h
       XOR cx , cx
       LEA si , str


LP:  Mov ah , 01h
       int 21h
       cmp al , 0dh ; this stops as soon as you press enter 
       JZ stop
       Mov [si] , al
       inc si
       inc cx
       jmp LP

STOP:
         LEA dx , dis
         Mov ah , 09h
         int 21h
         LEA si , str

DISP:
        Mov dl , [si]
        Mov ah , 02h
        int 21h
        inc si
        DEC cx
        JNZ DISP
        Mov ah , 4ch
        int 21h

END

Well try this one and let me know if there any error exist

rahul8590 71 Posting Whiz

well cant help it my school preferred using that ancient compiler.......

rahul8590 71 Posting Whiz

i already have fedora installed into my system so that isnt a problem at all . its just that i am finding difficulty in upgrading myself from an ancient turbo -c compiler to the latest GCC compiler and the IDE called code blocks .
so almost all my code which was working in turbo c doesn not function here , besides there isnt ne book that specifically teaches you for the GCC compiler , its all trial n error .

ne ways thanks for ur suggestion.

rahul8590 71 Posting Whiz

i would love to try that , besides i just got a mail from the belinix developer when i asked about the GRUB stuff . n this is wat i was told in return .

BeleniX also uses Grub so you can mumti-boot. However the installer
does not yet detect all other partitions, so you will need to note down
the Grub boot entries from the menu.lst file in Fedora and then add
them into BeleniX's menu.lst (/rpool/boot/grub/menu.lst) by hand.

well i could nt much comprehend from that .
well does this mean that i have to configure the grub manually or its best to run ot from live cd..?

rahul8590 71 Posting Whiz

well when i ran this program

#include<iostream.h>
int main()
{
}

it didnt give me ne errors .
well i work on codeblocks IDE and GCC compiler i guess

rahul8590 71 Posting Whiz

yes i have installed fedora , its just that many people dont use it much (i dont know how far its true n i dont know why ) .
besides its got a lot of GUI which doesnt help me knowing Linux from the scratch .
i would be glad if there some distro of Linux exist which helps in learning the stuff from the rock bottom .

rahul8590 71 Posting Whiz

yeah .. that sounds k . but did you try this way i mentioned . before ?

rahul8590 71 Posting Whiz

So which compiler is the best for image handling and to perform complex tasks .
thanks NicAx64 for the links you gave it help me a lot.

rahul8590 71 Posting Whiz

templates provide direct support for generic programming to represent a wide range of concepts.
firstly i would recommend you to do the double linked list program normally and then start programming normal template programs .
finally you can club these two concepts.

for a double linked list i guess you will have to make a class list which contains the left pointer and the right pointer and the information you need .

#include<iostream.h>
using namespace std;

class list 
{
        public :
                   class node 
                   {
                        node *lptr;
                         int info;  // here i have just used a integer u can   //have the information u have to put insidew the node u want to //create
                        node *rptr;
                      
                        public :
                          node ()
                          {
                                    lptr=rptr=NULL;
                           }
               };
               node *header;
                list()
                {
                 header = NULL;
                }
 };
rahul8590 71 Posting Whiz

At the first place i dont know wat r u trying to do here .

Well i guess if you include the main header file also i.e
#include<iostream.h>
u may not get this error.

rahul8590 71 Posting Whiz

Well i was reading the theoratical part of image processing and in that it specifically memtioned that the c compiler (i guess the turbo c) can handle only these two file formats , and not the one which is very ubiquitous (JPEG) .

Well ne ways wat windows / llinux OS gotto do with these .
they might have written their own CODEC for all you know.

rahul8590 71 Posting Whiz

Well then which distro is the most stable and at the same time helps in learning more about the linux ...?

rahul8590 71 Posting Whiz

Well i am a complete neophyte in this part of c++ programming.
and by the way i would be glad if you could throw some insight on SDK ...?

rahul8590 71 Posting Whiz

i thought c++ handles only bmp and tiff (tagged image file format)..?

rahul8590 71 Posting Whiz

i am working on image processing , which intially i used to do using MATLAB . but now i have been told to do using
using JAVA or C++ programming ,.

Since i know the fundamentals of C++ i guess i would be the right choice
But the problem is : i dont know how to "handle/process" image files using C++ .


i would be glad if you guys can mention which is a better programming language for this scenario .?

rahul8590 71 Posting Whiz

first of all you have not explicitly mentioned your problem . second of all if you have your psedo code (which actually it isnt ) why dont you convert that into code itself...?

rahul8590 71 Posting Whiz

fine then by freeing the first node . we can delete the complete list .

rahul8590 71 Posting Whiz

Well at the first place . When the program run is over the OS itself deletes the linked list . so actually no need of deleting it using a destructor.

if u want to delete a link list all you have to do is free the first node of the list thats it .
if u have allocated the node using mallloc/calloc function then you can use free function to free the node or else
if you have new operator then you can use delete operator to fee the node.

rahul8590 71 Posting Whiz

yeah i get wat u said . but the point is if i make the the E drive empty and then repartion it and finally install the belinix distro in it .At the time of booting Will belinix distro detect the fedora 7 which is already present and the windows xp ....?

rahul8590 71 Posting Whiz

Well when ur normally running your laptop (which means not running ne program at that instance )
check how much processor % is being used .
usually it around 10 % or so if u arent running ne programs as such .
even in the ideal mode of the laptop if the processor usage is around 50 % or higher , then it seems like some potentially unwanted programs are running .

rahul8590 71 Posting Whiz

fine .
i have a 250 gb hard disk .
only around 10 - 12 gb i have given to fedora 7 and the rest allocated for windows .
50 gb - c drive
86.3 - d drive
85.9 gb - e drive

now i want to install belinix on top of it .
it just doesnt feel feasible. ne ingenious idea to accomplish my i wouldnt say ridiculous but sounds like that .

rahul8590 71 Posting Whiz

Well certainly i will remember that . thanks for mentioning it

rahul8590 71 Posting Whiz

assuming that somehow i have install . will it detect fedora or windows in that case....?

rahul8590 71 Posting Whiz

Well i have a windows xp and linux (fedora 7) partition . and now i have found a new distro of linux which is called Belinix .
its not very famous but has a lot to offer .
Well my problem is i want to install and run belinix , but i already have this partition and have no idea how to change i.

all ideas are welcomed and besides i would be glad if you could recommend ne other version of linux .

rahul8590 71 Posting Whiz

Well i intended to develop a sohisticated java server client program . but just couldnt push myself so far so ust had to satisfy myself with it.
Well , i have created a simple chatting interface . i would not call it a chatting interface actually cuz i had something else in my mind and finally landed on something else .

i would like if you guys could excecute it and help me making it a real chatting interface .

Well the basic thing is that . i have wriiten a server side code and then client side code .
the user complies one after the another and then runs those files in different DOS windows . Well i want to extend this to a real time chatting interface


the first is the UDPServer program
u will have to save the file as UDPServer (its case sensitive ) and compile it and run in in the first DOS window


the second file is UDPClient program . u will have to follow the same and then run it.
u might be able to chat (well not the traditional meaning here) in the two windows .

i hope u guys will give me ideas n help me improving it .

the code is there in the underneath link .
sorry guys just feel very lazy to post the stuff again .

http://www.daniweb.com/code/snippet1144.html

rahul8590 71 Posting Whiz

This just started recently. My laptop will turn off with no warning. It has done this a few times already, after the laptop has been on for maybe less than 10 minutes sometimes. I just earlier got the BSOD for the first time for this problem. The reason that it stated was DRIVER_POWER_STATE_FAILURE. I'm not sure which driver, or I guess possibly hardware unit, that could be causing it to just shut off like this. The laptop does get somewhat hot at times, so I'm guessing that something may have messed up one of the times that it got very hot. I'm just curious of which area I should be looking for to find out why this problem is occuring. Thanks.

Bluescreens can also be caused by physical faults such as faulty memory, power supplies, overheating of computer components, or hardware running beyond its specification limits.
contact the dealer immediately , ur lucky if ur laptop is in warranty