Untitled

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> using namespace std; void garis(int a) { int i; //Local Variable for (i=1;i<=a;i++) { printf("="); } printf("\n"); } void judul() { garis(40); puts("Contoh Program Struct"); garis(40); } string cek_nama() { string nama = "Nagita Elsa "; return nama; } string cek_email() { string email = "nagitaelsa39@gmail.com"; return email; } void author() { string get_nama = cek_nama(); cout<<"Nama : "<<get_nama<<endl; string get_email = cek_email(); cout<<"Email : "<<get_email<<endl; } int main() { judul(); /* By giving a name to the structure, you can treat it as a data type. This means that you can create variables with this structure anywhere in the program at any time. To create a named structure, put the name of the structure right after the struct keyword. */ struct data { char nama[15]; char nim[10]; int nilai; }; data mahasiswa; cout<<"Masukan Nama : <input>"; cin>>mahasiswa.nama; cout<<endl; cout<<"NIM : <input>"; cin>>mahasiswa.nim; cout<<endl; cout<<"Nilai Total : <input>"; cin>>mahasiswa.nilai; cout<<endl; garis(40); cout<<"Data Mahasiswa"<<endl; garis(40); cout<<"Nama Mahasiswa: "<<mahasiswa.nama<<endl; cout<<"NIM : "<<mahasiswa.nim<<endl; cout<<"Nilai Total : "<<mahasiswa.nilai<<endl; garis(40); author(); return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines