Ask your own question, for FREE!
Computer Science 10 Online
OpenStudy (anonymous):

Function to return the alphabetical minimum. typedef char Atom; Atom minim(Atom* a,int nr) { Atom mini; int i; mini=*a; for(i=1;i

OpenStudy (anonymous):

@amistre64 @Hero @nincompoop @sammixboo @kropot72 @Kainui @surjithayer @timo86m @Jaynator495

OpenStudy (anonymous):

Atom* sortat(GLista L) { GLista p; Atom *a; a=new Atom; int i; if(!L) { cout<<"Lista vida"; } else { for(p=L,i=0;!p;p=p->link,i++) { if(p->tag==ATOM) { *(a+i)=p->data.A; } else { sortat(p->data.L); } } } return a; } HERE IS THE CODE FOR THE CHAR POINTER I MUST FIND THE MINIMUM FOR

OpenStudy (anonymous):

@ganeshie8

OpenStudy (anonymous):

My minimum function doesnt work so well(it returns garbage values of ASCII code instead of returning me CHAR LETTERS which I inputed)

OpenStudy (amistre64):

what I would do (if i understood your syntax and i dont) is comment the code, explain what you are expecting each line to accomplish and how it is to be accomplished.

OpenStudy (amistre64):

i dont know what an alphabetical minimum is (assuming it may be the smallest ascii value?) define a reference point (R) to be the highest ascii value, or something absurd that is greater than any ascii value that can be written. split the input into an array; or if you know how to point to the string positions thats fine get the ascii value of the starting position, if that value is less then (R), then (R)=current ascii value repeat for the length of the string

OpenStudy (anonymous):

alphabetical minimum is the smallest ascii value for a capital letter

OpenStudy (anonymous):

i only deal with capital letters

OpenStudy (amistre64):

then you have a range to compare to, or do you uppercase the string?

OpenStudy (anonymous):

To understand better what's the meaning of this code: It's an application for generalised linked list: where input looks like this: (A,B,C) A->B->C->NIL (D,(Q,R),V) D->(ptr)->V->NIL |->Q->R->NIL

OpenStudy (anonymous):

the deal is to find the alphabetical minimum of all letters of the list and sublist so I thought putting all letters in an array would be a great idea.

OpenStudy (amistre64):

if the list is rather lengthy, it might do better to cycle thru the ascii values and compare to a finding/search function. does your coding language have something similar to: indexOf() http://www.w3schools.com/jsref/jsref_indexof.asp

OpenStudy (amistre64):

once the lowest value is found, break out of the 26 item loop :) other than that, someone else would be ore qualified im sure. my knowledge is not in syntax.

OpenStudy (anonymous):

my coding lang is c++ and the app doesnt require a certain level of COMPLEXITY

OpenStudy (anonymous):

i want to know why my minimum function doesnt return a correct value

OpenStudy (anonymous):

i've double checked every pointer instruction

OpenStudy (amistre64):

when i troubleshoot my code, i tend to have to do what i suggested - comment every line and make sure it is doing what i expect it to ... is it getting the correct input? is it following thru with the correct output? i cant go thru your code in that detail since i am just not that adept at the syntax you are using.

OpenStudy (anonymous):

how can i submit my whole code to you?

OpenStudy (anonymous):

attach is okay ?

OpenStudy (amistre64):

i dont have a complier to assess with, but someone else may.

OpenStudy (anonymous):

typedef char Atom; Atom minim(Atom* a,int nr) { Atom mini; int i; mini=*a; for(i=1;i<nr;i++) { if(*(a+i)<mini) { mini=*(a+i); } } return mini; }

OpenStudy (anonymous):

this function should get me the alphabetical minimum for every pointer I put, Am I right?

OpenStudy (amistre64):

your looping thru a length of nr not sure what *a is. or how it is being assessed .... Atom* a means nothing to me ... i cant read your code that well to make any specific logic of it but if *(a+i) is the ascii value of a position in an array, and if it is less than the current mini value, then yes we would want to redefine the mini value to match it. and when list is completed (as long as the process hasnt been reset along the way or some nonUPPER hasnt been introduced inadvertently) seems that it should work on the face of it.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!