Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raphaelrow/5858b959219f211f0a656f37df6fb9cd to your computer and use it in GitHub Desktop.
Save raphaelrow/5858b959219f211f0a656f37df6fb9cd to your computer and use it in GitHub Desktop.
Code for Word Jumbler in C/C++
#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<stdlib.h>
#include<string.h>
#include<fstream.h>
#include<time.h>
void main()
{
clrscr();
int xe;
while(!kbhit())
{
//starting screen
delay(15);
gotoxy(29,12);
xe=rand()%26+65;
textcolor(xe);
cprintf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",xe,xe,xe,xe,xe,xe,xe,xe,xe,xe,xe,xe,xe,xe,xe,xe,xe,xe,xe,xe,xe);
gotoxy(29,13);
cprintf("%c%c%c WORD JUMBLER %c%c%c",xe,xe,xe,xe,xe,xe);
gotoxy(29,14);
cprintf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",xe,xe,xe,xe,xe,xe,xe,xe,xe,xe,xe,xe,xe,xe,xe,xe,xe,xe,xe,xe,xe);
}
textcolor(15); // to setup the color back to white, otherwise the color of text was whatever that the upper loop left it at
getch();
srand(time(NULL)); // for getting randomized results every time you play the game
clrscr();
//__________________________________
// A list of thousand words are given below, make a txt document with notepad and save it in the location where your code for this program is saved
fstream fil;
fil.open("diary.TXT",ios::in); // inclusion of the list of words to be jumbled
char br;
int x,wjx, point=0,p=0;
char arr[1000][20];
while(!fil.eof())
{ fil>>arr[p]; //reading the contents of the file into the variable
p++;
}
long char array[1000][30]; // for making a copy of the words to compare for answers entered by the use
for(int o=0; o<1000; o++)
strcpy(array[o],arr[o]);
int n[1000]; // for noting down the lengths of each word.
for(int k=0; k<1000;k++)
{
for(int l=0; arr[k][l]!='\0'; l++);
n[k]=l;
}
int flag=0; // determines how many times the game will be played
for( int m=0; m<1000 && flag<=10; m=m+rand()%30+1) // a very trivial way to give the users random questions each time they play by using m
{
clrscr();
char b[100];
int c=n[m]-1;
while(c>=0) // to jumble the letters
{
x=rand()%n[m];
int temp=arr[m][x];
arr[m][x]=arr[m][c];
arr[m][c]=temp;
c--;
}
printf("\nGuess the word \n");
for(int j=0; j<=n[m]; j++)
printf("%c",arr[m][j]);
printf("\nnow enter your answer\n");
gets(b);
if(strcmpi(b,array[m])==0)
{
printf("\ncongrats correct answer \n");
point++;
}
else
{ printf("oops wrong answer\n");
cout<<"the answer is "<<array[m];
}
printf("\t\t\tyour score is %d", point);
getch();
flag++;
}
getch();
}
aardvark
abacus
abbey
abdomen
ability
abolishment
abroad
abuse
accelerant
accelerator
access
accident
accommodation
accompanist
accordion
account
accountant
achiever
acid
acknowledgment
acoustic
acoustics
acrylic
act
action
activity
actor
actress
acupuncture
ad
adapter
addiction
addition
address
adjustment
administration
adrenalin
adult
adulthood
advance
advancement
advantage
advertisement
advertising
advice
affair
affect
aftermath
afternoon
aftershave
aftershock
afterthought
age
agency
agenda
agent
aggression
aglet
agreement
aid
air
airbag
airbus
airfare
airforce
airline
airmail
airplane
airport
airship
alarm
alb
albatross
alcohol
alcove
alder
algebra
alibi
allergist
alley
alligator
alloy
almanac
almond
alpaca
alpenglow
alpenhorn
alpha
alphabet
alternative
altitude
alto
aluminium
aluminum
ambassador
ambition
ambulance
amendment
amount
amusement
anagram
analgesia
analog
analogue
analogy
analysis
analyst
anatomy
anesthesiology
anethesiologist
anger
angiosperm
angle
angora
angstrom
anguish
animal
anime
ankle
anklet
annual
anorak
answer
ant
anteater
antechamber
antelope
anthony
anthropology
antler
anxiety
anybody
anything
anywhere
apartment
ape
aperitif
apology
apparatus
apparel
appeal
appearance
appendix
applause
apple
applewood
appliance
application
appointment
approval
apron
apse
aquifer
arch
archaeology
archeology
archer
architect
architecture
archrival
area
argument
arithmetic
arm
armadillo
armament
armchair
armoire
armor
armrest
army
arrival
arrow
art
artichoke
article
artificer
ascot
ash
ashram
ashtray
aside
ask
asparagus
aspect
asphalt
assignment
assist
assistance
assistant
associate
association
assumption
asterisk
astrakhan
astrolabe
astrologer
astrology
astronomy
atelier
athlete
athletics
atmosphere
atom
atrium
attachment
attack
attempt
attendant
attention
attenuation
attic
attitude
attorney
attraction
audience
auditorium
aunt
author
authorisation
authority
authorization
automaton
avalanche
avenue
average
award
awareness
azimuth
babe
baboon
babushka
baby
back
backbone
backdrop
background
backpack
bacon
bad
badge
badger
bafflement
bag
bagel
baggage
bagpipe
bail
bait
bake
baker
bakery
bakeware
balaclava
balalaika
balance
balcony
ball
ballet
balloon
ballpark
bamboo
banana
band
bandana
bandanna
bandolier
bangle
banjo
bank
bankbook
banker
banquette
baobab
bar
barbeque
barber
barbiturate
barge
baritone
barium
barn
barometer
barracks
barstool
base
baseball
basement
basin
basis
basket
basketball
bass
bassinet
bassoon
bat
bath
bather
bathhouse
bathrobe
bathroom
bathtub
batter
battery
batting
battle
battleship
bay
bayou
beach
bead
beak
beam
bean
beanie
beanstalk
bear
beard
beast
beat
beautiful
beauty
beaver
bed
bedroom
bee
beech
beef
beer
beet
beetle
beggar
beginner
beginning
begonia
behavior
beheading
behest
being
belfry
belief
believe
bell
belligerency
bellows
belly
belt
bench
bend
beneficiary
benefit
bengal
beret
berry
bestseller
bestseller
bet
beverage
beyond
bibliography
bicycle
bid
bidet
bifocals
big
bigrig
bijou
bike
bikini
bill
billboard
bin
biology
biplane
birch
bird
birdbath
birdcage
birdhouse
birdwatcher
birth
birthday
bit
bite
bitter
black
blackberry
blackboard
blackfish
bladder
blade
blame
blank
blanket
blazer
blight
blind
blinker
blister
blizzard
block
blocker
blood
bloodflow
bloom
bloomers
blossom
blouse
blow
blowgun
blowhole
blue
blueberry
boar
board
boat
boatbuilding
boatload
boatyard
bobcat
body
bog
bolero
bolt
bomb
bomber
bondsman
bone
bongo
bonnet
bonsai
bonus
boogeyman
book
bookcase
bookend
booklet
booster
boot
bootee
bootie
boots
booty
border
bore
bosom
boss
botany
bother
bottle
bottling
bottom
bottomline
boudoir
bough
boundary
bow
bower
bowl
bowler
bowling
bowtie
box
boxer
boxspring
boy
boyfriend
bra
brace
bracelet
bracket
brain
brake
branch
brand
brandy
brass
brassiere
bratwurst
brave
bread
breadcrumb
break
breakfast
breakpoint
breast
breastplate
breath
breeze
bribery
brick
bricklaying
bridge
brief
briefs
brilliant
british
broad
broccoli
brochure
broiler
broker
brome
bronchitis
bronco
bronze
brooch
brood
brook
broom
brother
brotherinlaw
brow
brown
brush
brushfire
brushing
bubble
bucket
buckle
bud
buddy
budget
buffer
buffet
bug
buggy
bugle
building
bulb
bull
bulldozer
bullet
bullfighter
bumper
bun
bunch
bungalow
bunghole
bunkhouse
burglar
burlesque
burn
burnout
burst
bus
bush
business
bust
bustle
butane
butcher
butter
button
buy
buyer
buzzard
cabana
cabbage
cabin
cabinet
cable
caboose
cacao
cactus
caddy
cadet
cafe
caftan
cake
calcification
calculation
calculator
calculus
calendar
calf
calico
call
calm
camel
cameo
camera
camp
campaign
campanile
can
canal
cancel
cancer
candelabra
candidate
candle
candy
cane
cannon
canoe
canon
canopy
canteen
canvas
cap
cape
capital
capitulation
capon
cappelletti
cappuccino
captain
caption
car
caravan
carbon
card
cardboard
cardigan
care
career
cargo
carload
carnation
carol
carotene
carp
carpenter
carpet
carport
carriage
carrier
carrot
carry
cart
cartilage
cartload
cartoon
cartridge
cascade
case
casement
cash
cashier
casino
casserole
cassock
cast
castanet
castanets
castle
cat
catacomb
catamaran
catch
category
caterpillar
cathedral
catsup
cattle
cauliflower
cause
caution
cave
cclamp
cd
ceiling
celebration
celeriac
celery
celeste
cell
cellar
cello
celsius
cement
cemetery
cenotaph
census
cent
center
centimeter
centurion
century
cephalopod
ceramic
cereal
certification
cesspool
chafe
chain
chainstay
chair
chairlift
chairman
chairperson
chaise
chalet
chalice
chalk
challenge
champion
championship
chance
chandelier
change
channel
chaos
chap
chapel
chapter
character
chard
charge
charity
charlatan
charles
charm
chart
chastity
chasuble
chateau
chauffeur
chauvinist
check
checkroom
cheek
cheetah
chef
chemical
chemistry
cheque
cherries
cherry
chess
chest
chick
chicken
chicory
chief
chiffonier
child
childhood
children
chill
chime
chimpanzee
chin
chino
chip
chipmunk
chitchat
chivalry
chive
chocolate
choice
choker
chop
chopstick
chord
chowder
chrome
chromolithograph
chronograph
chronometer
chub
chug
church
churn
cicada
cigarette
cinema
circle
circulation
circumference
cirrus
citizenship
city
civilisation
claim
clam
clank
clapboard
clarinet
clasp
class
classic
classroom
clause
clave
clavicle
clavier
cleaner
cleat
cleavage
clef
cleric
clerk
click
client
cliff
climate
climb
clip
clipper
cloak
cloakroom
clock
clockwork
clogs
cloister
close
closet
cloth
clothes
clothing
cloud
cloudburst
cloudy
clove
clover
club
clue
clutch
coach
coal
coast
coat
cob
cobweb
cockpit
cockroach
cocktail
cocoa
cod
code
codon
codpiece
coevolution
coffee
coffin
coil
coin
coinsurance
coke
cold
coliseum
collar
collection
college
collision
colloquia
colon
colonisation
colony
color
colt
column
columnist
comb
combat
combination
combine
comfort
comfortable
comic
comma
command
comment
commerce
commercial
commission
committee
common
communicant
communication
community
company
comparison
compassion
competition
competitor
complaint
complement
complex
component
comportment
composer
composition
compost
comprehension
compulsion
computer
comradeship
concentrate
concept
concern
concert
conclusion
concrete
condition
condominium
condor
conductor
cone
confectionery
conference
confidence
confirmation
conflict
confusion
conga
congo
congress
congressman
congressperson
conifer
connection
consent
consequence
consideration
consist
console
consonant
conspirator
constant
constellation
construction
consul
consulate
contact
contact lens
contagion
content
contest
context
continent
contract
contrail
contrary
contribution
control
convection
conversation
convert
convertible
cook
cookie
cooking
coonskin
cope
copout
copper
coproducer
copy
copyright
copywriter
cord
corduroy
cork
cormorant
corn
corner
cornerstone
cornet
corral
correspondent
corridor
corruption
corsage
cost
costume
cot
cottage
cotton
couch
cougar
cough
council
councilman
councilor
councilperson
count
counter
counterforce
countess
country
county
couple
courage
course
court
cousin
covariate
cover
coverall
cow
cowbell
cowboy
crab
crack
cracker
crackers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment