Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ XML Windows OOP
#include<iostream>
#include<string>
#include<stdlib.h>
#include<process.h>
#include<windows.h>

using namespace std;
class current
{
private:
	char choice;
	int x,y;
 
public:
	current()
	{
		
	}
	void currentcash()
 
	{
		char ch;
        
		cout<<"\n\n\n\n\n\n\n\n\n\nWell come to UBL\n\n";
		Sleep(3000);
		system("cls");
		cout<<"\n\n\n\n\n\n\n\n\n\nPlease enter you card and Press any key\n\n";
		cin>>choice;
 
		
		cout<<"\n\n\n\n\n\n\n\n\n\nHave you entered the card?\nPress 1 for 'YES' and 0 for 'NO'\n\n";
		cin>>x;
		if(x==0)
		{
			return;
		}
		
		cout<<"\n\n\n\n\n\n\n\n\n\nPlease enter your four digit pin code\n\n";
		cin>>y;
		for(y=1;y<=4;y++)
        {
			if(y>='0' && y<='9')
             {
                    cout<<"*";
             }
	    }
	}   
            
};
int total=100000;
class fastcash
{
	public: 
	
public:
	fastcash()
	{
		total=100000;
	}
	void operatecash()
	{
		int a;
		//int total;
		if(total==0)
		{
			cout<<"You have not sufficient balance";
			Sleep(6000);
			return;
		}
		cout<<"\n\nPress 1 for 'RS.500' \n";
		cout<<"Press 2 for 'RS.1000' \n";
		cout<<"Press 3 for 'RS.1500' \n";
		cout<<"Press 4 for 'RS.2000' \n";
		cout<<"Press 5 for 'RS.2500' \n";
		cout<<"Press 6 for 'RS.25000' \n";
		cout<<"Press 0 for Main Menu \n";
		cin>>a;
		if(a==1 || a==2 || a==3 || a==4 || a==5 ||a==6)
		{
			int b;
			if(a==1)
				total-=500;
			if(a==2)
				total-=1000;
			if(a==3)
				total-=1500;
			if(a==4)
				total-=2000;
			if(a==5)
				total-=2500;
			if(a=6)
				total-=25000;
			cout<<"\nDo you want to make another transection press 1?";
			cin>>b;
			if (b==1)
			{
				operatecash();
			
				}
				else
				{
					cout<<"No\n";
					cout<<"\n\n\n\nThanks for banking with UBL";
					Sleep(2000);
					{
					system("cls");
					Sleep(8000);
					return;
					//current::currentcash();
					}
				}
	    }
	}
};
class cashinquiry:public current
{
public:
	void operateinquiry()
	{
		int b;
		cout<<total;
		cout<<"\n\nDo you want to have receipt?\nPress 1 for 'Yes' else anyother key";
		cin>>b;
				if(b==1)
				{
					cout<<"Yes\n";
					Sleep(2000);
					cout<<"\n\n\n\nThanks for banking with UBL";
					Sleep(2000);
					{
					system("cls");
					Sleep(8000);
					current::currentcash();
					}
				}
				else
				{
					cout<<"No\n";
					cout<<"\n\n\n\nThanks for banking with UBL";
					Sleep(2000);
					{
					system("cls");
					Sleep(8000);
					current::currentcash();
					}
				}
 
    }
};
class fundtransfer:public current
{
public:
	void operatefund()
	{
 
		int c,d,e,f;
		cout<<"How much money do you want to transfer?\n";
		cin>>c;
		if(total<c)>
		{
			cout<<"You don't have that much money to transfer\n";
			Sleep(6000);
			return;
		}
		
		total=total-c;
		
		cout<<"Enter the account number in which you want to transfer money\n";
		cin>>d;
		cout<<"\n\nAre you sure that you want to transfer money?\n Press 1 for 'Yes' else anyother key\n\n";
		cin>>e;
				if(e==1)
				{
					cout<<"Yes\n";
				}
				else
				{
					cout<<"No\n";
				}
				cout<<"Do you want to make another money transfer?\nPress 1 for 'YES' and 0 for 'NO'\n";
				cin>>f;
				if(f==0)
				{
					system("cls");
					cout<<"\n\n\n\nThanks for banking with UBL";
					Sleep(2000);
					{
					system("cls");
					Sleep(8000);
					current::currentcash();
					}
				}
	}
};
int main()
{
	system ("color 1f");
	current c;
	fastcash fc;
	cashinquiry ci;
	fundtransfer ft;
	c.currentcash();
 
	int i;
	while(1)
	{
		system("cls");
		cout<<"\n\nPlease select Transection type\n\n";
		cout<<"\n\nPress 1 for 'FAST CASH' \n";
		cout<<"Press 2 for 'ACCOUNT INQUIRY' \n";
		cout<<"Press 3 for 'FUND TRANSFER' \n";
		cout<<"Press 0 for 'Exit' \n";
		cin>>i;
		switch(i)
		{
		case 1:
		fc.operatecash();
		break;
		case 2:
		ci.operateinquiry();
		break;
		case 3:
		ft.operatefund();
		break;
		case 0:
		exit(0);
	}
	}
	system("pause");
}
 
[edit]Code block added - OriginalGriff[/edit]
Posted 19-May-13 4:32am
Edited 23-May-13 1:30am
CPallini329.3K
v4
Comments
CPallini at 23-May-13 6:32am
   
You might convert a C++ Code to XML the same way you convert a fish to a cyclist.
Matt T Heffron at 23-May-13 14:49pm
   
A virtual +5 for the laugh!
CPallini at 23-May-13 16:24pm
   
Thank you.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You can't.
XML is a language similar to HTML used for creating structured documents and web pages.
C++ is a general purpose object oriented programming langusge.
 
You cannot comfortably store information in C++; you cannot process information or write an application in XML.
 
See here: http://www.w3schools.com/xml/[^]
And here: http://groups.engin.umd.umich.edu/CIS/course.des/cis400/xml/xml.html[^]
  Permalink  
Comments
Muhammad Ali at 19-May-13 9:58am
   
ok1 then how can i store it using xml
OriginalGriff at 19-May-13 10:18am
   
Store what? You don't store or retrieve anything that I can see on a cursory scan of your code.
Muhammad Ali at 19-May-13 10:22am
   
Is there anything in this program, that we can do in xml??
OriginalGriff at 19-May-13 10:25am
   
No - XML is a structure for storing data, in the same way that a database or a spreadsheet is - if you don't store data then you can't do much with it. (And yes, I know that Excel and SQL allow you to code as well: XML doesn't)
Muhammad Ali at 19-May-13 10:28am
   
I was asked to do filing of this program, so is there any other way?
Muhammad Ali at 19-May-13 10:48am
   
filing is possible in this progrram?
OriginalGriff at 19-May-13 10:53am
   
What do you want to file? Yes, you could store transactions but first, you have to work out what you need to store, and how you want to store it.
I suggest that you look at your homework instructions, and the notes from the last lecture - that should help you get started! :laugh:
Muhammad Ali at 19-May-13 10:55am
   
of-course i want to store transactions so please tell me how.. coz i spent my whole day making this program..
OriginalGriff at 19-May-13 11:52am
   
Start here:
https://www.google.co.uk/search?q=XML+c%2B%2B&aq=f&oq=XML+c%2B%2B
 
You will find a large number of ways.
Muhammad Ali at 19-May-13 12:01pm
   
Thanks!
OriginalGriff at 19-May-13 12:16pm
   
You're welcome!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

as stated earlier by others, XML is not a programming language its like HTML a markup language.
what best you can do is break up the code in to two parts, part1 reading the configuration xml
and part2 processing the xml.
 
so the place where you are taking the user inputs can be converted to configuration xml like below
 
<atminputs>
 <transaction type="" /> <!-- 1= FASTCASH, 2 = BALANCEINQUIRY, 3 = FUNDTRANSFER -->
 <fastcash amount="" /> <!-- user needs to fill this -->
 <balanceinquiry receipt="" pincode="" />
 <fundtransdfer amount="" toaccount="" />
<atminputs>
 
so this becomes your input XML from user, and then rest processing remains the same.
so just parse the inputs from the xml and then do rest of the operations.
Like if user sets value as 1, then readonly values present in tag fastcash and do the processing.
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 DamithSL 440
1 OriginalGriff 194
2 BillWoodruff 170
3 Zoltán Zörgő 165
4 Maciej Los 163
0 OriginalGriff 7,934
1 DamithSL 6,084
2 Sergey Alexandrovich Kryukov 5,449
3 Maciej Los 5,174
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 23 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100