Jump to content

Ortalama Hesaplayıcı - Autoplay Media Studio


HalilYanar
 Share

Recommended Posts

Arkadaşlar aklımda bir proje vardı yaptım bitti fakat gördüm ki Inputların birine bile sayı değeri girilmeyince program kendi hatasını veriyor. Aşağıda ortalama bulma projesinin resmi ve .apz dosyası var;

[img]http://i.imgur.com/AULlR.png[/img]

.Apz :

[quote]http://www.mediafire.com/?b45moknp1kfcm39[/quote]

Veya ortalama butonundaki kodlar :

[quote]a = Input.GetText("Input1");
b = Input.GetText("Input2");
c = Input.GetText("Input3");
d = Input.GetText("Input4");
e = Input.GetText("Input5");
f = Input.GetText("Input6");
g = Input.GetText("Input7");
h = Input.GetText("Input8");
i = Input.GetText("Input9");
u = Input.GetText("Input10");
y = Input.GetText("Input11");
m = Input.GetText("Input12");
t = Input.GetText("Input13");
n = Input.GetText("Input14");

mata = String.ToNumber(a)
matb = String.ToNumber(B)
matc = String.ToNumber(c)
matd = String.ToNumber(d)
mate = String.ToNumber(e)
matf = String.ToNumber(f)
matg = String.ToNumber(g)
math = String.ToNumber(h)
matj = String.ToNumber(i)
mati = String.ToNumber(u)
matk = String.ToNumber(y)
matl = String.ToNumber(m)
matm = String.ToNumber(t)
matt = String.ToNumber(n)

toplam = (a + b + c + d + e + f + g + h + i + u + y + m + t + n)

bolum = (14)

oran = (toplam / bolum)

Input.SetText("Input16", oran)[/quote]

Benim sorunum ise şu eğer inputların birine bile değer yani sayı girilmezse hata vericek. Üstadlarımın yardımlarını bekliyorum.

Edited by HalilYanar
Link to comment
Share on other sites

Aşağıdaki örneği incele.
[xml]
sVeri = Input.GetText("Input1");
sDeger = Input.GetText("Input2");
if sVeri == "" and sDeger == "" then
Dialog.Message("Notice", "Lütfen değer girin", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end[/xml]

Link to comment
Share on other sites

  • Editor

for i = 1,14 do
get = Input.GetText("Input"..i);
if get == "" then
Dialog.Message("Hata !","Lütfen "..i..". Notu giriniz.")
break;
end
end

Edited by pairs
Link to comment
Share on other sites

Ayrıca HalilYanar arkadaşım senin bu program eğer kodları yukarıda verdiğin gibiyse hata verir. Neden diyeceksin: Çünkü ben 5 tane ders notu girsem bile sen toplamı 14 e bölüyorsun. Buna dikkat et.

Link to comment
Share on other sites

verdiğiniz kodlar yanlış sonuca gider, çünkü arkadaşın dediği gibi 5 ders girse sonucu 5 e bölmesi gerek.

[codebox]-- 14 input olduğu için 14 lük döngü
nToplam = 0;
nAdet = 0;
for i=1,14 do
sMetin = Input.GetText("Input" .. i)
if sMetin ~= "" then
nMetin = String.ToNumber(sMetin)
nToplam = nToplam+nMetin
nAdet = nAdet+1
end
end
-- eğer veri girişi yapilmissa
if nAdet ~= 0 then
Input.SetText("Input16", nToplam/nAdet)
end[/codebox]

projede birazda değişiklik yaptım. Inputlardaki maski kaldirip yerine kodla sayi girişi kontrolu koydum. tabi birde temizle buttonu.

APZ:

[quote]http://www.mediafire.com/?2jj7ng6wv06n2f7[/quote]

Link to comment
Share on other sites

KintaRo üstad düzenlediğin projeyi indirdim ama şu inputlarda ne yaptığını çözemedim. Zahmet olmassa az açıklayabilirmisin . AMS de yeni sayılırım kusura bakmayın


Edit: Üstad sen sadece sayı girilmesini sağlarken backspace tusununda çalışmasını engellemissin herhangi bi imputa yanlış girince hepsini temizlemek gerekiyor...

Edited by woramon
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...