can u help me convert the cout to printf..i dont have a clue how.. tnx [CODE]#include<iostream.h> #include<string.h> #include<conio.h> int findSimilar(char[],char[]); void checkValue(int,int); int main(){ char boy[50]; char girl[50]; int similarInBoy=0; int similarInGirl=0; int total; clrscr(); cout<<"Enter Boy's Name: "; cin.getline(boy,50); cout<<"Enter Girl's Name: "; cin.getline(girl,50); similarInBoy=findSimilar(boy,girl); similarInGirl=findSimilar(girl,boy); total=similarInGirl+similarInBoy; cout<<"Boy: "<<similarInBoy<<","; checkValue(similarInBoy,1); cout<<"\n"; cout<<"Girl: "<<similarInGirl<<","; checkValue(similarInGirl,2); cout<<"\n"; cout<<"Total: "<<total<<","; checkValue(total,3); cout<<"\n"; getch(); return 0; } void checkValue(int similar,int gender){ if(gender==1){ if(similar>6) similar%=6; switch(similar){ case 1: cout<<"Friend"; break; case 2: cout<<"Love"; break; case 3: cout<<"Affair"; break; case 4: cout<<"Married"; break; case 5: cout<<"Enemy"; break; case 6: cout<<"Sweetheart"; break; } } else if(gender==2){ …

Member Avatar
Member Avatar
+0 forum 6

I have heard that games can be built using c language. I request someone to post the code for a simple game.(if possible,simple code too)..

Member Avatar
Member Avatar
-1 forum 13

Do you know that there is clean way of doing what C-language ternary operator ? does in Python's recent versions. It is if with special twist. The syntax is: [CODE]'The value if true' if <condition> else 'Value when false'[/CODE] Values can be any type. You can put this structure to replace single value. In this classic number guess game version we practise using the structure even in a nested way. This is not maybe so advisable general way, as it is less clear than many print statements in normal if statement. Anyway, this came first to my mind as demonstration …

Member Avatar
+0 forum 0

The End.