0% found this document useful (0 votes)
2K views1 page

CONTOH Soal Pointer C++

This C++ program allows a user to input purchase codes and quantities. It then outputs a receipt listing the item codes, names, and prices. The user is prompted to enter a number of purchases and for each one, a code (A/a for Honda at 500k or B/b for Yamaha at 450k). The codes and associated names and prices are stored in arrays. Finally, a formatted output is printed listing the item numbers, codes, names, and prices.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views1 page

CONTOH Soal Pointer C++

This C++ program allows a user to input purchase codes and quantities. It then outputs a receipt listing the item codes, names, and prices. The user is prompted to enter a number of purchases and for each one, a code (A/a for Honda at 500k or B/b for Yamaha at 450k). The codes and associated names and prices are stored in arrays. Finally, a formatted output is printed listing the item numbers, codes, names, and prices.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include<conio.

h>
#include<iostream.h>
#include<stdio.h>
#include<iomanip.h>
main()
{
int a,jb;
char kd[50],*sk[50];
long h[50];
clrscr();
cout<<"masukan jumlah beli : ";cin>>jb;
for(a=1;a<=jb;a++)
{
cout<<"masukan kode : ";cin>>kd[a];
if(kd[a]=='a'||kd[a]=='A')
{
sk[a]="honda";
h[a]=500000;
}
else if(kd[a]=='b'||kd[a]=='B')
{
sk[a]="yamaha";
h[a]=450000;
}
else
cout<<"salah kode...."<<endl;
}
cout<<"\n\t\tTekan enter.."<<endl;
getche();
clrscr();
cout<<"-------------------------------------------"<<endl;
cout<<"No. Suku cadang Harga "<<endl;
cout<<"-------------------------------------------"<<endl;
for(a=1;a<=jb;a++)
{
cout<<setiosflags(ios::left)<<setw(4)<<a;
cout<<setiosflags(ios::left)<<setw(6)<<kd[a];
cout<<setiosflags(ios::left)<<setw(13)<<sk[a];
cout<<setiosflags(ios::left)<<setw(5)<<h[a]<<endl;
}
cout<<"-------------------------------------------"<<endl;
getch();
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy