Jump to content

Geri Döndüren Bir Fonksiyon


onder
 Share

Recommended Posts

Kendisine parametre olarak gönderilen bir karakter dizisi içersinde yine kendisine parametre olarak gönderilen bir karakteri arayan ve bu karaktere dizinin hangi elamanlarında t-rastladığını geri döndüren bir fonksiyon yazmam lazım ödev için bir örnek yapabilecek arkadaş var mıdır.? ( C de)
Link to comment
Share on other sites

Abi C bilmem ama mantık açısından autoitte verdim kodu:

[code]if $cmdline[0] <> 2 then
MsgBox(16,"Hata","Parametre hatası.",5)
Elseif StringLen($cmdline[1]) = 3 or StringLen($cmdline[2]) = 3 Then
for $i = 1 to 2
if StringLeft($cmdline[$i],2) = "-n" Then
$n = StringTrimLeft($cmdline[$i],2)
EndIf
Next
for $i = 1 to 2
if StringLeft($cmdline[$i],2) = "-s" and StringLen($cmdline[$i]) = 3 Then
$s = StringRight($cmdline[$i],1)
EndIf
Next
$ayir = StringSplit($n,$s)
for $i = 1 to $ayir[0]
if $i = 1 Then
$ayir[$i] = StringLen($ayir[$i]) + 1
Else
$ayir[$i] = StringLen($ayir[$i]) + 1 + $ayir[$i-1]
EndIf
Next
for $i = 1 to $ayir[0]-1
MsgBox(0,"Sonuç:","Aradığınız karakter satır içinde "&$ayir[$i]&". karakterdir")
Next
Else
MsgBox(16,"Hata","Aranacak karakter sayısı 1 olmalı.",5)
EndIf[/code]

Kullanımı: bilmemne.exe -naranacakkalima -sa

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...