Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Converting a string.


  • Please log in to reply
3 replies to this topic

#1 rusoman

rusoman

  • Members
  • 14 posts
  • OFFLINE
  •  
  • Local time:06:21 PM

Posted 20 January 2009 - 07:22 AM

How to convert string.

Ex.

1. If the word starts with 'qu' or 'c', convert it to 'kw' or 'k' respectively
ex. quit --> kwit
cast --> kast

2. If the word contains 'ee' consecutively, change to 'i'
ex. meet --> mit

I have 14 more rules.

How can I convert it, can you give me the algorithm? I'm using C. Thanks. :thumbsup:

BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:04:21 AM

Posted 20 January 2009 - 08:02 AM

What do you have so far? We are happy to help with programming questions, but nobody is going to give you anything. We prefer to help you learn. :thumbsup:

#3 rusoman

rusoman
  • Topic Starter

  • Members
  • 14 posts
  • OFFLINE
  •  
  • Local time:06:21 PM

Posted 20 January 2009 - 08:12 AM

#include<stdio.h>

#include<conio.h>

#include<string.h>



 char message,temp,*text;

 void func1();

 void func2();

 void func3();

 void func4();

 void func5();

 void func6();

 void func7();

 void func8();

 void func9();

 void func10();

 void func11();

 void func12();

 void func13();

 void func14();





void main()

{

 clrscr();

printf("Enter a message: ");

gets(message);

strlwr(message);

text=strtok(message," ");

while(text!=NULL)

{func1();

 func2();

 func3();

 func4();

 func5();

 func6();

 func7();

 func8();

 func9();

 func10();

 func11();

 func12();

 func13();

 func14();

 text=strtok(NULL," ")

}

printf("Your text message is: %s",temp);



getch();

}



 func1()

 {}

 func2()

 {}

 func3()

 {}

 func4()

 {}

 func5()

 {}

 func6()

 {}

 func7()

 {}

 func8()

 {}

 func9()

 {}

 func10()

 {}

 func11()

 {}

 func12()

 {}

 func13()

 {}

 func14()

 {}


#4 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:04:21 AM

Posted 20 January 2009 - 08:31 AM

Well there's your problem right there. None of your functions have anything in them. :thumbsup:

Maybe this will get you started?
http://cermics.enpc.fr/~ts/C/FUNCTIONS/fun...ref.html#string

This page has some useful examples:
http://www.cs.cf.ac.uk/Dave/C/node19.html

I am pretty sure that you are going to need some 'if' statements also.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users