Rekapan Tugas C++
#include<iostream>
#include<conio.h>
#include<iomanip>
#include<fstream>
#include<windows.h>
void gotoxy(int x, int y)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
using namespace std;
int main (){
menu:
system("cls");
int pilih,pilihop,pilihword,pilihexcel,pilihtxt;
gotoxy(87,5);cout<<"||"<<endl;gotoxy(87,6);cout<<"||"<<endl;gotoxy(87,7);cout<<"||"<<endl;gotoxy(87,14);cout<<"||"<<endl;gotoxy(87,12);cout<<"||"<<endl;
gotoxy(87,4);cout<<"||"<<endl;gotoxy(35,14);printf("====================================================");gotoxy(87,3);cout<<"||"<<endl;
gotoxy(87,8);cout<<"||"<<endl;gotoxy(87,9);cout<<"||"<<endl;gotoxy(87,10);cout<<"||"<<endl;gotoxy(87,13);cout<<"||"<<endl;gotoxy(87,11);cout<<"||"<<endl;
gotoxy(35,5);cout<<"||"<<endl;gotoxy(35,6);cout<<"||"<<endl;gotoxy(35,7);cout<<"||"<<endl;gotoxy(35,14);cout<<"||"<<endl;gotoxy(35,12);cout<<"||"<<endl;
gotoxy(35,4);cout<<"||"<<endl;gotoxy(35,3);cout<<"||"<<endl;
gotoxy(35,8);cout<<"||"<<endl;gotoxy(35,9);cout<<"||"<<endl;gotoxy(35,10);cout<<"||"<<endl;gotoxy(35,13);cout<<"||"<<endl;gotoxy(35,11);cout<<"||"<<endl;
gotoxy(35,0);
cout<<"====================Selamat Datang===================="<<endl;
gotoxy(35,1);
cout<<"|| Rekapan Tugas TPT ||"<<endl;
gotoxy(35,2);
cout<<"======================================================"<<endl;
gotoxy(37,4);
cout<<"Pilih Menu Yang Anda Inginkan ?"<<endl;
gotoxy(45,6);
cout<<"[1.] Segitiga Bintang"<<endl;
gotoxy(45,8);
cout<<"[2.] Matrix Bujur Sangkar "<<endl;
gotoxy(45,10);
cout<<"[3.] Operasi File "<<endl;
gotoxy(45,12);
cout<<"[4.] Keluar "<<endl;
gotoxy(42,16);
cout<<"Masukkan Nomor Menu Pilihan Anda = ";
cin>>pilih;
switch (pilih)
{
case 1 : system("cls");
int a,b,n;
char ulang;
do {
cout<<"Masukan Tinggi Segitiga : ";
cin>>n;
for (a=0; a<=n; a++)
{
for(b=1; b<=a; b++)
{
cout<<"*";
}
cout<<"\n";
}
cout<<"Apakah anda ingin mengulang program : ";
cout<<"Pilihan (y/n)"; cin>>ulang;
}
while((ulang=='y') || (ulang=='Y'));
cout<<"Tidak mengulang dan terima kasih"<<endl;
break;
case 2 : system("cls");
int i,j,ord0,bill;
char ulangmatrix;
do
{ cout<<"Matriks Ordo Berapa ?? : ";
cin>>ord0;
for(i=1;i<=ord0;i++)
{ bill=i;
for(j=1;j<=ord0;j++)
{ cout<<setw(3)<<bill<<" ";
bill=bill+ord0;
}
cout<<"\n";
}
cout<<"Apakah anda ingin mengulang program : ";
cout<<"Pilihan (y/n)"; cin>>ulangmatrix;
}
while((ulangmatrix=='Y')||(ulangmatrix=='y'));
cout<<"Tidak mengulang dan terima kasih"<<endl;
break;
case 3 : menus:
system("cls");
gotoxy(87,5);cout<<"||"<<endl;gotoxy(87,6);cout<<"||"<<endl;gotoxy(87,7);cout<<"||"<<endl;gotoxy(87,14);cout<<"||"<<endl;gotoxy(87,12);cout<<"||"<<endl;
gotoxy(87,4);cout<<"||"<<endl;gotoxy(35,14);printf("====================================================");gotoxy(87,3);cout<<"||"<<endl;
gotoxy(87,8);cout<<"||"<<endl;gotoxy(87,9);cout<<"||"<<endl;gotoxy(87,10);cout<<"||"<<endl;gotoxy(87,13);cout<<"||"<<endl;gotoxy(87,11);cout<<"||"<<endl;
gotoxy(35,5);cout<<"||"<<endl;gotoxy(35,6);cout<<"||"<<endl;gotoxy(35,7);cout<<"||"<<endl;gotoxy(35,14);cout<<"||"<<endl;gotoxy(35,12);cout<<"||"<<endl;
gotoxy(35,4);cout<<"||"<<endl;gotoxy(35,3);cout<<"||"<<endl;
gotoxy(35,8);cout<<"||"<<endl;gotoxy(35,9);cout<<"||"<<endl;gotoxy(35,10);cout<<"||"<<endl;gotoxy(35,13);cout<<"||"<<endl;gotoxy(35,11);cout<<"||"<<endl;
gotoxy(35,0);
cout<<"====================Selamat Datang===================="<<endl;
gotoxy(35,1);
cout<<"|| Rekapan Tugas Operasi File ||"<<endl;
gotoxy(35,2);
cout<<"======================================================"<<endl;
gotoxy(37,4);
cout<<"Pilih Menu Yang Anda Inginkan ?"<<endl;
gotoxy(45,6);
cout<<"[1.] MS.Word"<<endl;
gotoxy(45,8);
cout<<"[2.] MS.Excel"<<endl;
gotoxy(45,10);
cout<<"[3.] TEXT"<<endl;
gotoxy(45,12);
cout<<"[4.] Keluar "<<endl;
gotoxy(42,16);
cout<<"Masukkan Nomor Menu Pilihan Anda = ";
cin>>pilihop;
switch (pilihop){
case 1 : system("cls");
gotoxy(87,5);cout<<"||"<<endl;gotoxy(87,6);cout<<"||"<<endl;gotoxy(87,7);cout<<"||"<<endl;gotoxy(87,14);cout<<"||"<<endl;gotoxy(87,12);cout<<"||"<<endl;
gotoxy(87,4);cout<<"||"<<endl;gotoxy(35,14);printf("====================================================");gotoxy(87,3);cout<<"||"<<endl;
gotoxy(87,8);cout<<"||"<<endl;gotoxy(87,9);cout<<"||"<<endl;gotoxy(87,10);cout<<"||"<<endl;gotoxy(87,13);cout<<"||"<<endl;gotoxy(87,11);cout<<"||"<<endl;
gotoxy(35,5);cout<<"||"<<endl;gotoxy(35,6);cout<<"||"<<endl;gotoxy(35,7);cout<<"||"<<endl;gotoxy(35,14);cout<<"||"<<endl;gotoxy(35,12);cout<<"||"<<endl;
gotoxy(35,4);cout<<"||"<<endl;gotoxy(35,3);cout<<"||"<<endl;
gotoxy(35,8);cout<<"||"<<endl;gotoxy(35,9);cout<<"||"<<endl;gotoxy(35,10);cout<<"||"<<endl;gotoxy(35,13);cout<<"||"<<endl;gotoxy(35,11);cout<<"||"<<endl;
gotoxy(35,0);
cout<<"====================Selamat Datang===================="<<endl;
gotoxy(35,1);
cout<<"|| Operasi File MS.Word ||"<<endl;
gotoxy(35,2);
cout<<"======================================================"<<endl;
gotoxy(37,4);
cout<<"Pilih Menu Yang Anda Inginkan ?"<<endl;
gotoxy(45,6);
cout<<"[1.] Insert"<<endl;
gotoxy(45,8);
cout<<"[2.] Read"<<endl;
gotoxy(42,16);
cout<<"Masukkan Nomor Menu Pilihan Anda = ";
cin>>pilihword;
if (pilihword==1){
ofstream outFile;
outFile.open("coba.doc",ios::app);
string baris;
int jmlh;
float nomor;
cout<<"Berapa jumlah baris yang ingin anda input : ";cin>>jmlh;
cout<<endl;
nomor=1;
cin.get();
do
{
cout<<"Baris ke -"<<nomor<<"= ";
getline(cin,baris);
outFile<<baris<<endl;
nomor++;
}
while (nomor<=jmlh);
outFile.close();
}
if (pilihword==2){
ifstream myFile;
string buffer;
// ios::in
// ios::ate = mulai dari akhir file
// ios::binary
myFile.open("coba.doc");
while(!myFile.eof()){
getline(myFile,buffer);
cout<<buffer<< endl;
}
myFile.close();
}
break;
case 2 : system("cls");
gotoxy(87,5);cout<<"||"<<endl;gotoxy(87,6);cout<<"||"<<endl;gotoxy(87,7);cout<<"||"<<endl;gotoxy(87,14);cout<<"||"<<endl;gotoxy(87,12);cout<<"||"<<endl;
gotoxy(87,4);cout<<"||"<<endl;gotoxy(35,14);printf("====================================================");gotoxy(87,3);cout<<"||"<<endl;
gotoxy(87,8);cout<<"||"<<endl;gotoxy(87,9);cout<<"||"<<endl;gotoxy(87,10);cout<<"||"<<endl;gotoxy(87,13);cout<<"||"<<endl;gotoxy(87,11);cout<<"||"<<endl;
gotoxy(35,5);cout<<"||"<<endl;gotoxy(35,6);cout<<"||"<<endl;gotoxy(35,7);cout<<"||"<<endl;gotoxy(35,14);cout<<"||"<<endl;gotoxy(35,12);cout<<"||"<<endl;
gotoxy(35,4);cout<<"||"<<endl;gotoxy(35,3);cout<<"||"<<endl;
gotoxy(35,8);cout<<"||"<<endl;gotoxy(35,9);cout<<"||"<<endl;gotoxy(35,10);cout<<"||"<<endl;gotoxy(35,13);cout<<"||"<<endl;gotoxy(35,11);cout<<"||"<<endl;
gotoxy(35,0);
cout<<"====================Selamat Datang===================="<<endl;
gotoxy(35,1);
cout<<"|| Operasi File MS.Excel ||"<<endl;
gotoxy(35,2);
cout<<"======================================================"<<endl;
gotoxy(37,4);
cout<<"Pilih Menu Yang Anda Inginkan ?"<<endl;
gotoxy(45,6);
cout<<"[1.] Insert"<<endl;
gotoxy(45,8);
cout<<"[2.] Read"<<endl;
gotoxy(45,10);
gotoxy(42,16);
cout<<"Masukkan Nomor Menu Pilihan Anda = ";
cin>>pilihexcel;
if (pilihexcel==1){
ofstream inFile;
inFile.open("coba.csv",ios::app);
string baris;
int jmlh;
float nomor;
cout<<"Berapa jumlah baris yang ingin anda input : ";cin>>jmlh;
nomor=1;
cin.get();
do
{
cout<<"Baris ke -"<<nomor<<"= ";
getline(cin,baris);
inFile<<baris<<endl;
nomor++;
}
while (nomor<=jmlh);
inFile.close();
}
if (pilihexcel==2){
ifstream meFile;
string buffer;
// ios::in
// ios::ate = mulai dari akhir file
// ios::binary
meFile.open("coba.csv");
while(!meFile.eof()){
getline(meFile,buffer);
cout<<buffer<< endl;
}
meFile.close();
}
break;
case 3 : system("cls");
gotoxy(87,5);cout<<"||"<<endl;gotoxy(87,6);cout<<"||"<<endl;gotoxy(87,7);cout<<"||"<<endl;gotoxy(87,14);cout<<"||"<<endl;gotoxy(87,12);cout<<"||"<<endl;
gotoxy(87,4);cout<<"||"<<endl;gotoxy(35,14);printf("====================================================");gotoxy(87,3);cout<<"||"<<endl;
gotoxy(87,8);cout<<"||"<<endl;gotoxy(87,9);cout<<"||"<<endl;gotoxy(87,10);cout<<"||"<<endl;gotoxy(87,13);cout<<"||"<<endl;gotoxy(87,11);cout<<"||"<<endl;
gotoxy(35,5);cout<<"||"<<endl;gotoxy(35,6);cout<<"||"<<endl;gotoxy(35,7);cout<<"||"<<endl;gotoxy(35,14);cout<<"||"<<endl;gotoxy(35,12);cout<<"||"<<endl;
gotoxy(35,4);cout<<"||"<<endl;gotoxy(35,3);cout<<"||"<<endl;
gotoxy(35,8);cout<<"||"<<endl;gotoxy(35,9);cout<<"||"<<endl;gotoxy(35,10);cout<<"||"<<endl;gotoxy(35,13);cout<<"||"<<endl;gotoxy(35,11);cout<<"||"<<endl;
gotoxy(35,0);
cout<<"====================Selamat Datang===================="<<endl;
gotoxy(35,1);
cout<<"|| Operasi File Text ||"<<endl;
gotoxy(35,2);
cout<<"======================================================"<<endl;
gotoxy(37,4);
cout<<"Pilih Menu Yang Anda Inginkan ?"<<endl;
gotoxy(45,6);
cout<<"[1.] Insert"<<endl;
gotoxy(45,8);
cout<<"[2.] Read"<<endl;
gotoxy(45,10);
gotoxy(42,16);
cout<<"Masukkan Nomor Menu Pilihan Anda = ";
cin>>pilihtxt;
if (pilihtxt==1){
ofstream iniFile;
iniFile.open("coba.txt",ios::app);
string baris;
int jmlh;
float nomor;
cout<<"Berapa jumlah baris yang ingin anda input : ";cin>>jmlh;
nomor=1;
cin.get();
do
{
cout<<"Baris ke -"<<nomor<<"= ";
getline(cin,baris);
iniFile<<baris<<endl;
nomor++;
}
while (nomor<=jmlh);
iniFile.close();
}
if (pilihtxt==2){
ifstream miFile;
string buffer;
// ios::in
// ios::ate = mulai dari akhir file
// ios::binary
miFile.open("coba.txt");
while(!miFile.eof()){
getline(miFile,buffer);
cout<<buffer<< endl;
}
miFile.close();
}
break;
}break;
case 4 :
gotoxy(42,20);
cout<<"Terima Kasih"<<endl;
break;
default :
cout<<"Pilihan Anda Tidak Ada di Menu"<<endl;
}
return 0;
}
#include<conio.h>
#include<iomanip>
#include<fstream>
#include<windows.h>
void gotoxy(int x, int y)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
using namespace std;
int main (){
menu:
system("cls");
int pilih,pilihop,pilihword,pilihexcel,pilihtxt;
gotoxy(87,5);cout<<"||"<<endl;gotoxy(87,6);cout<<"||"<<endl;gotoxy(87,7);cout<<"||"<<endl;gotoxy(87,14);cout<<"||"<<endl;gotoxy(87,12);cout<<"||"<<endl;
gotoxy(87,4);cout<<"||"<<endl;gotoxy(35,14);printf("====================================================");gotoxy(87,3);cout<<"||"<<endl;
gotoxy(87,8);cout<<"||"<<endl;gotoxy(87,9);cout<<"||"<<endl;gotoxy(87,10);cout<<"||"<<endl;gotoxy(87,13);cout<<"||"<<endl;gotoxy(87,11);cout<<"||"<<endl;
gotoxy(35,5);cout<<"||"<<endl;gotoxy(35,6);cout<<"||"<<endl;gotoxy(35,7);cout<<"||"<<endl;gotoxy(35,14);cout<<"||"<<endl;gotoxy(35,12);cout<<"||"<<endl;
gotoxy(35,4);cout<<"||"<<endl;gotoxy(35,3);cout<<"||"<<endl;
gotoxy(35,8);cout<<"||"<<endl;gotoxy(35,9);cout<<"||"<<endl;gotoxy(35,10);cout<<"||"<<endl;gotoxy(35,13);cout<<"||"<<endl;gotoxy(35,11);cout<<"||"<<endl;
gotoxy(35,0);
cout<<"====================Selamat Datang===================="<<endl;
gotoxy(35,1);
cout<<"|| Rekapan Tugas TPT ||"<<endl;
gotoxy(35,2);
cout<<"======================================================"<<endl;
gotoxy(37,4);
cout<<"Pilih Menu Yang Anda Inginkan ?"<<endl;
gotoxy(45,6);
cout<<"[1.] Segitiga Bintang"<<endl;
gotoxy(45,8);
cout<<"[2.] Matrix Bujur Sangkar "<<endl;
gotoxy(45,10);
cout<<"[3.] Operasi File "<<endl;
gotoxy(45,12);
cout<<"[4.] Keluar "<<endl;
gotoxy(42,16);
cout<<"Masukkan Nomor Menu Pilihan Anda = ";
cin>>pilih;
switch (pilih)
{
case 1 : system("cls");
int a,b,n;
char ulang;
do {
cout<<"Masukan Tinggi Segitiga : ";
cin>>n;
for (a=0; a<=n; a++)
{
for(b=1; b<=a; b++)
{
cout<<"*";
}
cout<<"\n";
}
cout<<"Apakah anda ingin mengulang program : ";
cout<<"Pilihan (y/n)"; cin>>ulang;
}
while((ulang=='y') || (ulang=='Y'));
cout<<"Tidak mengulang dan terima kasih"<<endl;
break;
case 2 : system("cls");
int i,j,ord0,bill;
char ulangmatrix;
do
{ cout<<"Matriks Ordo Berapa ?? : ";
cin>>ord0;
for(i=1;i<=ord0;i++)
{ bill=i;
for(j=1;j<=ord0;j++)
{ cout<<setw(3)<<bill<<" ";
bill=bill+ord0;
}
cout<<"\n";
}
cout<<"Apakah anda ingin mengulang program : ";
cout<<"Pilihan (y/n)"; cin>>ulangmatrix;
}
while((ulangmatrix=='Y')||(ulangmatrix=='y'));
cout<<"Tidak mengulang dan terima kasih"<<endl;
break;
case 3 : menus:
system("cls");
gotoxy(87,5);cout<<"||"<<endl;gotoxy(87,6);cout<<"||"<<endl;gotoxy(87,7);cout<<"||"<<endl;gotoxy(87,14);cout<<"||"<<endl;gotoxy(87,12);cout<<"||"<<endl;
gotoxy(87,4);cout<<"||"<<endl;gotoxy(35,14);printf("====================================================");gotoxy(87,3);cout<<"||"<<endl;
gotoxy(87,8);cout<<"||"<<endl;gotoxy(87,9);cout<<"||"<<endl;gotoxy(87,10);cout<<"||"<<endl;gotoxy(87,13);cout<<"||"<<endl;gotoxy(87,11);cout<<"||"<<endl;
gotoxy(35,5);cout<<"||"<<endl;gotoxy(35,6);cout<<"||"<<endl;gotoxy(35,7);cout<<"||"<<endl;gotoxy(35,14);cout<<"||"<<endl;gotoxy(35,12);cout<<"||"<<endl;
gotoxy(35,4);cout<<"||"<<endl;gotoxy(35,3);cout<<"||"<<endl;
gotoxy(35,8);cout<<"||"<<endl;gotoxy(35,9);cout<<"||"<<endl;gotoxy(35,10);cout<<"||"<<endl;gotoxy(35,13);cout<<"||"<<endl;gotoxy(35,11);cout<<"||"<<endl;
gotoxy(35,0);
cout<<"====================Selamat Datang===================="<<endl;
gotoxy(35,1);
cout<<"|| Rekapan Tugas Operasi File ||"<<endl;
gotoxy(35,2);
cout<<"======================================================"<<endl;
gotoxy(37,4);
cout<<"Pilih Menu Yang Anda Inginkan ?"<<endl;
gotoxy(45,6);
cout<<"[1.] MS.Word"<<endl;
gotoxy(45,8);
cout<<"[2.] MS.Excel"<<endl;
gotoxy(45,10);
cout<<"[3.] TEXT"<<endl;
gotoxy(45,12);
cout<<"[4.] Keluar "<<endl;
gotoxy(42,16);
cout<<"Masukkan Nomor Menu Pilihan Anda = ";
cin>>pilihop;
switch (pilihop){
case 1 : system("cls");
gotoxy(87,5);cout<<"||"<<endl;gotoxy(87,6);cout<<"||"<<endl;gotoxy(87,7);cout<<"||"<<endl;gotoxy(87,14);cout<<"||"<<endl;gotoxy(87,12);cout<<"||"<<endl;
gotoxy(87,4);cout<<"||"<<endl;gotoxy(35,14);printf("====================================================");gotoxy(87,3);cout<<"||"<<endl;
gotoxy(87,8);cout<<"||"<<endl;gotoxy(87,9);cout<<"||"<<endl;gotoxy(87,10);cout<<"||"<<endl;gotoxy(87,13);cout<<"||"<<endl;gotoxy(87,11);cout<<"||"<<endl;
gotoxy(35,5);cout<<"||"<<endl;gotoxy(35,6);cout<<"||"<<endl;gotoxy(35,7);cout<<"||"<<endl;gotoxy(35,14);cout<<"||"<<endl;gotoxy(35,12);cout<<"||"<<endl;
gotoxy(35,4);cout<<"||"<<endl;gotoxy(35,3);cout<<"||"<<endl;
gotoxy(35,8);cout<<"||"<<endl;gotoxy(35,9);cout<<"||"<<endl;gotoxy(35,10);cout<<"||"<<endl;gotoxy(35,13);cout<<"||"<<endl;gotoxy(35,11);cout<<"||"<<endl;
gotoxy(35,0);
cout<<"====================Selamat Datang===================="<<endl;
gotoxy(35,1);
cout<<"|| Operasi File MS.Word ||"<<endl;
gotoxy(35,2);
cout<<"======================================================"<<endl;
gotoxy(37,4);
cout<<"Pilih Menu Yang Anda Inginkan ?"<<endl;
gotoxy(45,6);
cout<<"[1.] Insert"<<endl;
gotoxy(45,8);
cout<<"[2.] Read"<<endl;
gotoxy(42,16);
cout<<"Masukkan Nomor Menu Pilihan Anda = ";
cin>>pilihword;
if (pilihword==1){
ofstream outFile;
outFile.open("coba.doc",ios::app);
string baris;
int jmlh;
float nomor;
cout<<"Berapa jumlah baris yang ingin anda input : ";cin>>jmlh;
cout<<endl;
nomor=1;
cin.get();
do
{
cout<<"Baris ke -"<<nomor<<"= ";
getline(cin,baris);
outFile<<baris<<endl;
nomor++;
}
while (nomor<=jmlh);
outFile.close();
}
if (pilihword==2){
ifstream myFile;
string buffer;
// ios::in
// ios::ate = mulai dari akhir file
// ios::binary
myFile.open("coba.doc");
while(!myFile.eof()){
getline(myFile,buffer);
cout<<buffer<< endl;
}
myFile.close();
}
break;
case 2 : system("cls");
gotoxy(87,5);cout<<"||"<<endl;gotoxy(87,6);cout<<"||"<<endl;gotoxy(87,7);cout<<"||"<<endl;gotoxy(87,14);cout<<"||"<<endl;gotoxy(87,12);cout<<"||"<<endl;
gotoxy(87,4);cout<<"||"<<endl;gotoxy(35,14);printf("====================================================");gotoxy(87,3);cout<<"||"<<endl;
gotoxy(87,8);cout<<"||"<<endl;gotoxy(87,9);cout<<"||"<<endl;gotoxy(87,10);cout<<"||"<<endl;gotoxy(87,13);cout<<"||"<<endl;gotoxy(87,11);cout<<"||"<<endl;
gotoxy(35,5);cout<<"||"<<endl;gotoxy(35,6);cout<<"||"<<endl;gotoxy(35,7);cout<<"||"<<endl;gotoxy(35,14);cout<<"||"<<endl;gotoxy(35,12);cout<<"||"<<endl;
gotoxy(35,4);cout<<"||"<<endl;gotoxy(35,3);cout<<"||"<<endl;
gotoxy(35,8);cout<<"||"<<endl;gotoxy(35,9);cout<<"||"<<endl;gotoxy(35,10);cout<<"||"<<endl;gotoxy(35,13);cout<<"||"<<endl;gotoxy(35,11);cout<<"||"<<endl;
gotoxy(35,0);
cout<<"====================Selamat Datang===================="<<endl;
gotoxy(35,1);
cout<<"|| Operasi File MS.Excel ||"<<endl;
gotoxy(35,2);
cout<<"======================================================"<<endl;
gotoxy(37,4);
cout<<"Pilih Menu Yang Anda Inginkan ?"<<endl;
gotoxy(45,6);
cout<<"[1.] Insert"<<endl;
gotoxy(45,8);
cout<<"[2.] Read"<<endl;
gotoxy(45,10);
gotoxy(42,16);
cout<<"Masukkan Nomor Menu Pilihan Anda = ";
cin>>pilihexcel;
if (pilihexcel==1){
ofstream inFile;
inFile.open("coba.csv",ios::app);
string baris;
int jmlh;
float nomor;
cout<<"Berapa jumlah baris yang ingin anda input : ";cin>>jmlh;
nomor=1;
cin.get();
do
{
cout<<"Baris ke -"<<nomor<<"= ";
getline(cin,baris);
inFile<<baris<<endl;
nomor++;
}
while (nomor<=jmlh);
inFile.close();
}
if (pilihexcel==2){
ifstream meFile;
string buffer;
// ios::in
// ios::ate = mulai dari akhir file
// ios::binary
meFile.open("coba.csv");
while(!meFile.eof()){
getline(meFile,buffer);
cout<<buffer<< endl;
}
meFile.close();
}
break;
case 3 : system("cls");
gotoxy(87,5);cout<<"||"<<endl;gotoxy(87,6);cout<<"||"<<endl;gotoxy(87,7);cout<<"||"<<endl;gotoxy(87,14);cout<<"||"<<endl;gotoxy(87,12);cout<<"||"<<endl;
gotoxy(87,4);cout<<"||"<<endl;gotoxy(35,14);printf("====================================================");gotoxy(87,3);cout<<"||"<<endl;
gotoxy(87,8);cout<<"||"<<endl;gotoxy(87,9);cout<<"||"<<endl;gotoxy(87,10);cout<<"||"<<endl;gotoxy(87,13);cout<<"||"<<endl;gotoxy(87,11);cout<<"||"<<endl;
gotoxy(35,5);cout<<"||"<<endl;gotoxy(35,6);cout<<"||"<<endl;gotoxy(35,7);cout<<"||"<<endl;gotoxy(35,14);cout<<"||"<<endl;gotoxy(35,12);cout<<"||"<<endl;
gotoxy(35,4);cout<<"||"<<endl;gotoxy(35,3);cout<<"||"<<endl;
gotoxy(35,8);cout<<"||"<<endl;gotoxy(35,9);cout<<"||"<<endl;gotoxy(35,10);cout<<"||"<<endl;gotoxy(35,13);cout<<"||"<<endl;gotoxy(35,11);cout<<"||"<<endl;
gotoxy(35,0);
cout<<"====================Selamat Datang===================="<<endl;
gotoxy(35,1);
cout<<"|| Operasi File Text ||"<<endl;
gotoxy(35,2);
cout<<"======================================================"<<endl;
gotoxy(37,4);
cout<<"Pilih Menu Yang Anda Inginkan ?"<<endl;
gotoxy(45,6);
cout<<"[1.] Insert"<<endl;
gotoxy(45,8);
cout<<"[2.] Read"<<endl;
gotoxy(45,10);
gotoxy(42,16);
cout<<"Masukkan Nomor Menu Pilihan Anda = ";
cin>>pilihtxt;
if (pilihtxt==1){
ofstream iniFile;
iniFile.open("coba.txt",ios::app);
string baris;
int jmlh;
float nomor;
cout<<"Berapa jumlah baris yang ingin anda input : ";cin>>jmlh;
nomor=1;
cin.get();
do
{
cout<<"Baris ke -"<<nomor<<"= ";
getline(cin,baris);
iniFile<<baris<<endl;
nomor++;
}
while (nomor<=jmlh);
iniFile.close();
}
if (pilihtxt==2){
ifstream miFile;
string buffer;
// ios::in
// ios::ate = mulai dari akhir file
// ios::binary
miFile.open("coba.txt");
while(!miFile.eof()){
getline(miFile,buffer);
cout<<buffer<< endl;
}
miFile.close();
}
break;
}break;
case 4 :
gotoxy(42,20);
cout<<"Terima Kasih"<<endl;
break;
default :
cout<<"Pilihan Anda Tidak Ada di Menu"<<endl;
}
return 0;
}
Comments
Post a Comment