Sabtu, 03 Januari 2015

Borland C++ Nested IF

Borland C ++ is still unresolved ...
what is the problem huh?
Help me ...
anyone help solve this problem.
using nested IF, but there were 4 cases here.
IF its use should be how?
Wear IF, ELSE IF, ELSE IF, ELSE IF but not running well.
what to do?
The brain seems to be broken,
do you know? a lot of smoke coming out of my head hehehe
head burned, pierced by the sword felt, and even sometimes like to be broken.
really confusing is not it?
I was desperate to find an answer of this question, but if I was desperate then there final exam scores that I have will be worth the bad.
I do not want that to happen.
I want to keep my grades good.
but how is this?
I've been looking at various ways GOOGLE
but still no help.
huh
you want to know about what I get?
it is because:
Case 1: If you buy tickets for 2 pieces, you get an umbrella but do not get a discount.
case 2: if you buy 3 tickets, you will get a discount of 5% and a bonus one umbrella .
case 3: if you buy 4 pieces of tickets, you will get a discount of 10% and get a bonus of a single umbrella.
case 4: if you buy 1 piece of tickets, you do not get a discount and you do not get a bonus.
1 piece ticket price = 15000

how about this?
how to?
I've made this in C ++ programs

#include <stdio.h>
#include <conio.h>
#include <iostream.h>
main(void)
{
double tk,beli,pot,jumbay, hartik, jumtik;
clrscr();
cout<<"Daftar Pembelian  Tiket\n\n";
cout<<"Harga satu tiket = 15000\n";
cout<<"Berapakah jumlah tiket yang akan dibeli...? ";cin>>tk;
beli=tk*15000;
cout<< "jumlah tiket yg dibeli= "<<jumtik;
cout<<endl;
if(tk=2)
{
pot=0;
cout<<"selamat anda mendapatkan payung\n";
}
else
if (tk=3)
pot=0.5*beli;


jumbay= hartik*beli-pot;

cout<<"Jumlah yang harus dibayar = Rp. "<<jumbay;
}

The program that I made had been "running"
but ...
still there I had to enter three pieces of the case, if added one more case of fruit, there will be "error"
right it makes me go crazy ...
I even had a couple doing a variety of program design but the result is still the same, unsolved ....
help me ......!
I was just hoping for a miracle from God that I can solve this problem.
can be seen right from the matter, it is an easy matter but in a really tough finish.
keep the spirit for the sake of the final exam. !!!
God help me.
I'm sure you're able to give me an answer.
I'm sure it ^^
as long as we are willing to be patient, trying, working hard, never give up and want to try and be accompanied by prayer sure everything will be resolved.
FIGHTING!!!
GANBATE!!!
Semangat CL ^+^

Tidak ada komentar:

Posting Komentar