The error I receive is:
program3.cpp:13:21: warning: format ‘%c’ expects argument of type ‘char*’, but argument 2 has type ‘std::string* {aka std::basic_string<char>*}’ [-Wformat=]
I'm probably lacking a very fundamental part of knowledge about the C++ language and I apologise for asking this novice question (once again). Also I would appreciate it if you could give feedback or point out other flaws in my code. What is wrong in my C++ code?
#include <iostream>
#include <stdio.h>
using namespace std;
int main(){
int harga=20000;
int diskon;
char pelanggan;
string jenisp;
printf("Apakah Pelanggan : [Y/N]");
scanf("%c",&pelanggan);
if(pelanggan=='Y'){
printf("Apa Jenis Pelanggan [Emas,Perak,Perunggu]:");
scanf("%c",&jenisp);
if(jenisp=="Emas"){
diskon=harga-(0.5*harga);
printf("Harga untuk pelanggan kartu Emas adalah : %d",diskon);
}
else if(jenisp=="Perak"){
diskon=harga-(0.25*harga);
printf("Harga untuk pelanggan kartu Perak adalah : %d",diskon);
}
else if(jenisp=="Perunggu"){
diskon=harga-(0.1*harga);
printf("Harga untuk pelanggan kartu Perunggu adalah : %d",diskon);
}
}
else{
printf("Harga untuk bukan pelanggan adalah : %d",harga);
}
return 0;
}