FLAMES[c++]

View previous topic View next topic Go down

FLAMES[c++]

Post by deathrowcore on Sun Nov 22, 2009 3:35 pm

FLAMES children game ^^ pang bata

Spoiler:
#include<iostream.h>
#include<string.h>
#include<conio.h>
int main()
{
int count=0,i,k,j,y,x,z;
char girl[80],boy[80],boy2[80],girl2[80],c,a='y';
/*the while statement here will make the program flexible*/
while((a=='y')||(a=='Y'))
{
count =0;
cout << "Characters,White Spaces and Dotes are onLy accepted here to get a correct output" << endl;
cout << "Boy:";
cin.getline(boy,80);//gets the name for the boy as a string character includes spaces
cout << "Girl:";
cin.getline(girl,80);//gets the name for the girl as a string character includes spaces
strcpy(boy2[80],boy[80]);//copies the string of the boy to boy2
strcpy(girl2[80],girl[80]);//copies the string of the boy to girl2
x=strlen(boy[80]);//counts the character including spaces and dotes
y=strlen(girl[80]);
strcat(boy2[80],girl2[80]);//concatinates the string boy2 and string girl2 returning the concatinated string @ boy2
//concatination means joining
z=strlen(boy2[80]);//counts the length of the concatinated string
/*the following nested loop will compare and count the same letters of the two strings(girl,boy)and concatinated string boy2
as well as the white spaces and dotes.
*/
for(i=0;i<y;i++)
{
for(j=0;j<y;j++)
{
if(boy[i]==girl[j])
{
c=boy[i];
for(k=0;k<z;k++)
{
if(c==boy2[80])
{
boy2[k]=='/';
count++;
}
}
}
}
}
/*eliminates the counted dote and white spaces from the original strings
this will make the counting of similar letters only counted*/
for(i=0;i<x;i++)
{
if((boy[i]=='.')||(boy[i]==' '))
count--;
}
for(j=0;j<y;j++)
{
if((girl[j]=='.')||(girl[j]==' '))
count--;
}

cout << "Result:";
/*filters the while loop into lowest so the switch statement can define if it is
Friends
Lovers
Angry
Married
Enemy
Sweet
*/
while(count>5)
count-=6;
/*displays the output of the program*/
switch(count)
{
case 0:
cout << "Friends";
break;
case 1:
cout << "Lovers";
break;
case 2:
cout << "Anger";
break;
case 3:
cout << "Married";
break;
case 4:
cout << "Enemy";
break;
case 5:
cout << "Sweet";
break;
default:
break;
}

cout << "Do you wish to continue? Y/N";
a=getch();//if the user inputs a wrong single character, the program will exit
}
cout << "End of the Program.";
}

compiler --> mind ^^
i dont have compiler, where can i get Turbo C++ 4.5?


Last edited by deathrowcore on Mon Nov 23, 2009 11:03 am; edited 3 times in total
avatar
deathrowcore
Newbie

Male
Posts : 17
Age : 25
Joined date : 2009-10-29
Location : pampanga
Cash : 13989

Back to top Go down

Re: FLAMES[c++]

Post by romgatchalian on Sun Nov 22, 2009 3:46 pm

any description dude?
avatar
romgatchalian
DPC Extreme

Male
Posts : 58
Age : 24
Joined date : 2009-11-21
Location : Quezon City
Cash : 13946

http://www.jorgyromgatchalian.co.cc

Back to top Go down

Re: FLAMES[c++]

Post by `PAU.sunshine on Sun Nov 22, 2009 3:47 pm

what is that ?
avatar
`PAU.sunshine
DPC Active Member

Female
Posts : 8457
Age : 22
Joined date : 2009-10-24
Location : ANTiPOLO CiTY
Cash : 21540

http://profiles.friendster.com/playgirlako

Back to top Go down

Re: FLAMES[c++]

Post by XED on Sun Nov 22, 2009 11:08 pm

mmh... what's that dude?


avatar
XED
Global Moderator
 Global Moderator

Male
Posts : 6137
Age : 107
Joined date : 2009-10-22
Location : sa bag mo :]]
Cash : 18562

Back to top Go down

Re: FLAMES[c++]

Post by danielvicedo on Tue Dec 08, 2009 12:42 am

Easy , wag nioh pagtulungan .

what's that for ?
avatar
danielvicedo
DPC Freak

Male
Posts : 1078
Age : 22
Joined date : 2009-10-16
Location : under my bebe's bed. :)
Cash : 14768

http://danielvicedo.tk

Back to top Go down

Re: FLAMES[c++]

Post by jhennyz on Fri Mar 05, 2010 12:01 am

tsktsk..

its hard to compile..

i have the compiler.. but i can't copy the code from this page to

turbo c..


if u already have the compiler..

its better if u'll post here the print screen of that output.. ^^
avatar
jhennyz
DPC Addict

Female
Posts : 148
Age : 25
Joined date : 2010-03-04
Location : ~NOWHERETOFiND~
Cash : 13996

Back to top Go down

Re: FLAMES[c++]

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum