I have just creted a loop to sort integers in the input loop who's it

A

Anshu

int a[100];
for(int i=0;;i++)
{cin>>a;
if(a==0)
break;
for(int j=0;j<i;j++)
//NEW SORT MECHANISM
if(a<a[j])
{int t=a;a=a[j];a[j]=t;}
}
 
F

Frederick Gotham

Anshu posted:
I have just creted a loop to sort integers in the input loop who's it


It (also referred to as Stephen King's It) is a 1990 horror miniseries
based on the Stephen King novel of the same name. Directed by Tommy Lee
Wallace, the film stars Tim Curry as It (Pennywise the Dancing Clown),
Richard Thomas as Bill Denbrough, John Ritter as Ben Hanscom, Annette
O'Toole as Beverly Marsh, Harry Anderson as Richie Tozier, Dennis
Christopher as Eddie Kaspbrak, Richard Masur as Stan Uris, and Tim Reid as
Mike Hanlon. The younger actors playing the flashback versions of the older
characters were, respectively, Jonathan Brandis, Brandon Crane, Emily
Perkins, Seth Green, Adam Faraizl, Ben Heller, and Marlon Taylor.

As in the novel, the central character of the film is the writer Bill
Denbrough, a thinly-veiled analogue of King himself. One of Denbrough's
novels, The Glowing, is seen on display in the Derry public library; this
is a reference to King's novel The Shining.

Radio Times magazine in 2004 held a survey for the scariest programme aired
on television, in which It came first. The X-Files came second. Others on
the top ten list included Twin Peaks, Ghostwatch and Tales of the
Unexpected.

It aired as a two-part television minseries on November 18, 1990 on ABC,
and loosely follows the plot of the novel. The first half of the film, set
in 1958, introduces the group of social outcasts, the "Losers", as they met
and form a tight-knit group in the face of a cruel and intolerant world.
They each individually come into contact with the child-killing monster
haunting their hometown of Derry, Maine, which they name "It". It usually
appears as Pennywise the Dancing Clown before taking the form of whatever
its child victim most greatly fears.

Spurred on by Bill Denbrough's desire for revenge on It for killing his
younger brother Georgie, the Losers resolve to locate Its home in the
sewers and destroy the threat to Derry once and for all. Despite managing
to inflict serious injuries upon the monster, they fail to finish the job,
allowing It to escape and recover over the years.

The second half of the film, set in 1990, focuses on the now-adult Losers
who reluctantly agree to return home (all of them except Mike Hanlon have
left Derry) to locate and destroy It once and for all. The Losers must
again face not only the terrible creature and the diminishing of their
circle after the suicide of Stan Uris, but also Henry Bowers (the bully who
made their childhoods miserable), now a madman under Its influence
determined to kill them all.

The television miniseries was done on a fairly modest budget, and thus
events in the book had to be ignored, especially if they would have
required expensive special effects. Wallace, the director, notes on the DVD
commentary that he was unhappy with the final result of the spider-like
"true" form of It.

The structure of the story is changed. In the movie, each of the people who
were affected by "It" while they were children receives a phone call asking
them to return to Derry. When this happens, they each have a flashback from
that year, and so this part of the story is revealed bit by bit. After the
adults have all arrived back in Derry, the story is presented in
chronological order throughout. Their rearrival in the book was told in
between the events of June and July of 1958. The end of the book alternated
between the characters going into the Barrens as children and as adults.

Another aspect of the television miniseries that is different from the
novel is the treatment of sexuality. In the novel, after the young Losers
escape from the sewer, Beverly Marsh has sex with the boys. This element of
sexual awakening, and the novel's mention of a gay bar in town and a gay-
bashing incident were dropped from the film. On the DVD audio commentary
Wallace states that he did not want to get into these sexuality issues.

Some of the major characters' backstories are either ignored or changed. In
the novel, Eddie Kaspbrak eventually tells his friends that he married a
neurotic woman similar to his mother, but in the television miniseries he
tells his friends that he is still a virgin, and there was possibly a
homoerotic undertone to his character as well.

The following characters were omitted from the film:

"It"'s natural enemy, the "Turtle"
Dorsey Corcoran and Eddie Corcoran, victims of "It" (Dorsey indirectly)
Mrs. Marsh, Beverly's mother
Vincent "Boogers" Taliendo, a rumor-spreading boy in the Losers' class
Patrick Hocksetter's younger brother Avery, who he murders by suffocation
Henry's insane father, Oscar "Butch" Bowers, who Henry kills by a knife to
the throat.
Beverly's friend Kay McCall. Beverly's husband Tom attacks her, demanding
to know where Beverly is.
The parents of many of the Losers, including Eddie and Mike
Adrian Mellon, a homosexual who is Its first victim in the cycle in 1985.
Dave Gardener, the man who finds Georgie's corpse. His son Harold, who is
also omitted from the film, is a witness during the murder of Adrian Mellon
 
D

Daniel T.

#include <iostream>
using std::cin;

int main() {
int a[100];
for(int i=0;;i++)
{cin>>a;
if(a==0)
break;
for(int j=0;j<i;j++)
//NEW SORT MECHANISM
if(a<a[j])
{int t=a;a=a[j];a[j]=t;}
}

}

Adding the lines above will allow your program to compile and run.
Whether it does what you want depends on what you wanted it to do.
 
T

Thomas J. Gritzan

Daniel said:
#include <iostream>
using std::cin;

int main() {
int a[100];
for(int i=0;;i++)

for (int i = 0; i < 100; i++)

Avoids the possible buffer overrun.
{cin>>a;
if(a==0)
break;
for(int j=0;j<i;j++)
//NEW SORT MECHANISM


Not new, but inefficient. The runtime is O(n^2).
if(a<a[j])
{int t=a;a=a[j];a[j]=t;}
}

}

Adding the lines above will allow your program to compile and run.
Whether it does what you want depends on what you wanted it to do.


Don't feed the trolls. ;-)
 
J

Jim Langston

Anshu said:
int a[100];
for(int i=0;;i++)
{cin>>a;
if(a==0)
break;
for(int j=0;j<i;j++)
//NEW SORT MECHANISM
if(a<a[j])
{int t=a;a=a[j];a[j]=t;}
}


Sorry to tell you, but I this almost exact code at in the 8th grade on an
Apple IIe in Basic. It's called a "swap sort". Nothing new about it, and
it's just about the most innefecient sort algorithm there is.

Incidently, I was in the 8th grade about 29 years ago.
 
H

Howard

Jim Langston said:
Anshu said:
int a[100];
for(int i=0;;i++)
{cin>>a;
if(a==0)
break;
for(int j=0;j<i;j++)
//NEW SORT MECHANISM
if(a<a[j])
{int t=a;a=a[j];a[j]=t;}
}


Sorry to tell you, but I this almost exact code at in the 8th grade on an
Apple IIe in Basic. It's called a "swap sort". Nothing new about it, and
it's just about the most innefecient sort algorithm there is.

Incidently, I was in the 8th grade about 29 years ago.


Better check your memory (or your math) again. If I recall correctly, the
Apple IIe wasn't released until 1983. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top