The above code used to work before having sub menu items to that menu item. After adding sub menu items, the previous code works for sub menu items but it would not work for menu item. Can anyone please help me out with this as where am i going wrong? Thank you
Hi, i was tring to figure how set display mode to fullscreen under win2000, i saw at msdn that theres a SetConsoleDisplayMode, but that is for winXP +..
I tried
//sets the console window
//to fullscreen
void FullScreen(){
HANDLE consolehandle;
int sysmetrics_x=GetSystemMetrics(SM_CXFULLSCREEN);//get full width
int sysmetrics_y=GetSystemMetrics(SM_CYFULLSCREEN);//get full height
#include <conio.h>
#include <graphics.h>
#include <math.h>
#include <stdlib.h>
#include <dos.h>
void serp(int level, int Ax, int Ay, int Bx, int By)
{
int poly[4]={Ax,Ay,Bx,By};
hi im new to daniweb im currently working on a piece of work. the idea is to create a bank account with deposit and withdrawal functions. create student business and current accounts (this is all roughly done and a case of copying and pasting for each account type with a different set of questions) . what it requires me to do is allow 10 accounts to be opened and then allow the user to search for each one and deposit and withdraw from each one. would anyone have any suggestions on how i could do this. below is my code so far and thankyou for taking the time to look. also it requires me to take an object orientated approach and im rather confused what this entails, any suggestions again would be appreciated.
1st - BANK.CPP
#include <iostream>
#include <string>
using namespace std;
int main()
{
// Declare Variables
int withdraw;
int sqone;
int sqtwo;
int bone;
string colname;
string name;
string sname;
int housenumber;
string postcode;
string dob;
string telno;
double acctbalance, deposit;
char choices;
acctbalance = 0;
//inputs, get the name and initial balance
do
{
cout<<"\n\n-------------------------------------------------\n";
cout << "What do you wish to do?" << endl;
cout << "O open new account" << endl;
cout << "C open new Business account" << endl;
cout << "D Deposit Money" << endl;
cout << "W Withdraw Money" << endl;
cout << "B Display Balance" << endl;
cout << "P Bank Account Details" << endl;
cout << "Q Quit" << endl<<endl;cout<<"Enter selection: ";
cin >> choices;
switch (choices)
{
//add account type options here under letter O
case 'O':
case 'o':
{
{
cout<<"\n\n-------------------------------------------------\n";
cout << "What Account Do You Wish To Open?" << endl;
cout << "S Student Account" << endl;
cout << "C Current Account" << endl;
cout << "B Business Account" << endl;
cout<<"Enter selection: ";
cin >> choices;
break;// Need a break statement here
}
}
//STUDENT ACCOUNT
case 'S':
case 's':
{
cout<<"Please Answer The Following Questions / 1 = Yes, 2 = No "<<endl;
cout<<"---------------------------------------------------------"<<endl;
cout<<"Are You A Full Time Student?"<<endl;
cin>>sqone;
if (sqone == 0)
{
cout << "sorry that is not a valid option"<< endl;
break;
}
if (sqone == 2)
{
cout<<"Sorry You Are Not Valid For This Account"<<endl;
break;
}
else if (sqone == 1)
{
cout<<"Thankyou"<<endl;
cout<<"Have You Got Documentation To Support Your Course And Accomadation?"<<endl;
cin>>sqtwo;
if (sqtwo == 0)
{
cout << "sorry that is not a valid option"<< endl;
break;
}
if (sqtwo == 1)
{
cout<<"Thankyou you are elegible for this account"<<endl;
cout<<"------------------------------------------"<<endl;
cout << "Colleague Name: ";
cin >> colname;
cout << "Enter First Name: ";
cin >> name;
cout << "Enter Surname: ";
cin >> sname;
cout << "House Number: ";
cin >> housenumber;
cout << "Post Code: ";
cin >> postcode;
cout << "Date Of Birth: ";
cin >> dob;
cout << "Telephone Number: ";
cin >> telno;
cout << "Please enter initial balance: ";
cin >> acctbalance;
break;
}
else if (sqtwo == 2)
{
cout<<"Sorry You Are Not Valid For This Account"<<endl;
break;
}
//BUSINESS ACCOUNT
case 'c':
case 'C':
{
cout<<"Please Answer The Following Questions / 1 = Yes, 2 = No "<<endl;
cout<<"---------------------------------------------------------"<<endl;
cout<<"Have you got documentation showing your business details?"<<endl;
cin>>bone;
if (bone == 0)
{
cout << "sorry that is not a valid option"<< endl;
break;
}
if (bone == 2)
{
cout<<"Sorry You Are Not Valid For This Account"<<endl;
break;
}
if (bone == 1)
{
cout<<"We Will Now Proceed To Open This Account For You?"<<endl;
cout<<"------------------------------------------"<<endl;
cout << "Colleague Name: ";
cin >> colname;
cout << "Enter First Name: ";
cin >> name;
cout << "Enter Surname: ";
cin >> sname;
cout << "House Number: ";
cin >> housenumber;
cout << "Post Code: ";
cin >> postcode;
cout << "Date Of Birth: ";
cin >> dob;
cout << "Telephone Number: ";
cin >> telno;
cout << "Please enter initial balance: ";
cin >> acctbalance;
break;
}
else if (sqtwo == 2)
{
cout<<"Sorry You Are Not Valid For This Account"<<endl;
break;
}
}
}
}
case 'D':
case 'd':
{
cout << "Enter amount to be deposited: "<< endl;
cin >>deposit;
if (deposit > 0)
{
acctbalance = acctbalance + deposit;
if (deposit >= 10000)
cout <<"Big Money!"<<endl;
break;
}
if (deposit == 0 || deposit < 0)
{
cout <<"Amount must be greater than 0";
break ;
}
}
case 'B':
case 'b':
{
cout <<"Your current balance is $ "<<acctbalance<<'.'<<endl;
if (acctbalance ==0)
cout <<"Big Money!"<<endl;
break;
}
case 'W':
case 'w':
{
cout<<"Please enter amount to withdraw "<<endl;
cout<<"Withdrawal must be multiple of 10"<<endl;
cin>>withdraw;
if (withdraw == 00)
{
cout << "Can't withdraw 0 dollars"<< endl;
break;
}
if (withdraw < 0)
{
cout<<"Must be a positive number"<<endl;
break;
}
if (withdraw > acctbalance)
{
cout<<"Can't withdraw more than balance"<<endl;
break;
}
if ((withdraw % 10) !=0)
{
cout<<"amount must be a multiple of 20"<<endl;
break;
}
else
{
acctbalance=acctbalance - withdraw;
cout<<"Here is your money. Enjoy!"<< endl;
break;
}
case 'P':
case 'p':
{
cout << "\n\n"<<endl;
cout <<"Personal Details"<<endl;
cout <<"First Name : "<<name<<endl;
cout <<"Surname : " <<sname<<endl;
cout <<"house number : " <<housenumber<<endl;
cout <<"post code : " <<postcode<<endl;
cout <<"telephone number : " <<telno<<endl;
cout <<"Your current balance is £ "<<acctbalance<<'.'<<endl;
if (acctbalance ==0)
cout <<"Big Money!"<<endl;
break;
}
}
case 'Q':
case 'q':
{
cout<<"Thank for using our services have a nice day!"<<endl;
break;
}
}
}while (choices != 'q' && choices != 'Q');
return 0;
}
and the 2nd class - account.h
#include <iostream>
#include <string>
using namespace std;
class Account
{
double money; // amount of money held by this account
double interestRate; // a monthly or yearly interestrate, depending on how the account is to be used.
public:
// create an account with an initial amountand a specified interest rate
Account(double amount, double percent)
{
money = amount;
interestRate = percent;
}
#include<iostream.h>
int main()
{
int row1[10];
int col2[10];
int m,n,p,q;
cout<<"Enter the number of rows in matrix A"<<endl;
cin>>m;
cout<<"Enter the number of columns in matrix A"<<endl;
cin>>n;
cout<<"Enter the number of rows in matrix B"<<endl;
cin>>p;
cout<<"Enter the number of columns in matrix B"<<endl;
cin>>q;
if(n!=p)
{
int i=0;
cout<<"enter the rows of matrix1"<<endl;
for(i=0;i<=m;i++)
{
cin>>row1[i];
int *ptrow= &row1[0];
row1[i]= *(row1+i);
}
cout<<"enter the cols of matrix1"<<endl;
int k=0;
for(k=0;k<=;k++;)
{
cin>>row1[k];
int *ptcol2= &col2[0];
col2[k]= *(col2+k);
}
int matpro (int row1, int col2, int (*matpro)(int,int));
{
int pro[i][k];
for(i=0;i<m;i++;)
{
for(k=0;k<=q;q++)
{
pro[i][k]= row1[i] * col2[k];
int *ptpro= &pro[0];
pro[i][k] = *(pro+i);
pro++;
}
}
cout << "[" << i << "][" << j << "]: " << pro[i][j];
return(pro[i][k]);
}
}
}
it is showing errors like
expected primary-expression before ‘;’ token
27: error: expected `)' before ‘;’ token
27: error: expected primary-expression before ‘)’ token
:27: error: expected `;' before ‘)’ token
:36: error: expected `)' before ‘;’ token
:36: error: expected primary-expression before ‘)’ token
:36: error: expected `;' before ‘)’ token
:48: error: expected `}' at end of input
:48: error: expected `}' at end of input
48: error: expected `}' at end of input
i just need to know is there any method in MFC / C++
which will do the validation for the entered date.
ie if the date 12/11/2008 is given as input it should return saying the date is valid.i hope there exsists some standard function.
it should also check for leap leap year,and wrong date such as 31/11/2008 etc. thanks in advance.
I've been trying to convert my Modular programming code from array to link list.. the whole program is kinda messy now.. could anyone help me figure out what problem am having with the code?
PS: am using Vc++6 to compile...
Thanks in Advance
I need help using an instance of a class in another. Below are two header files. NumDays.h and TimeOff.h
I need to have instances of the NumDays class in the TimeOff class as members. When i try to create the instance called maxSickDays, i do not get access to the NumDays member functions. What is wrong with my code? Thanks in advance.
OK, I'm making a backup application and once the backup is complete, I want it to flash
FINISHED!!!! - in different colours - any help at all would be appreciated, thanks - MaxICube
I am creating a linked list which links a struct of data together. However, this is my problem, if I declare struct Node first then the Event type wont exist, but if I declare struct Event first then nodePtr wont exist....im kinda stuck here as to how I should declare them.
I need to create a Space Invaders kind of game and I have a demo I need to copy the main features from. The invaders have to be of at least 3 different types and they change color.
So I figured the invaders are 3 child classes from a parent 'Invader' class that will have the methods of painting, moving, etc. What would be the best way to control the destruction of the invaders? I've read on this forum that a 'linked list' would be a way of doing just that. I don't know what a linked list is. So should I create an array that will store the position of the bullets (with a maximum of maybe 40 bullets). Is there a way to dynamically allocate memory for the bullets' position as they are created so I don't have an array of say 100 and use only 40?
The game will have sounds and the demo we've been given uses sound files located in the same folder the .exe is in, so they're not embedded (if that's how you would call it) or anything of that sort. The .exe is also got an icon.
We've been using PaintBox to draw stuff on application forms in Borland Builder so I think that's how it will be this time around too.
which co incides with each with the 16 rows, this is the error from each row.
is there a way i can put each of the 16 in order in the array and then mimic that into the weights array so that all of those are like the ones in the error array?
Im taking C++ courses in my collage (so ım a newbie) and they are teaching programing language a bit different from the examples in this forum.
#include <stdio.h>
int main (void)
{
int x;
int y;
int z;
int min;
printf("enter 3 numbers : ");
scanf("%d %d %d", &x,&y,&z);
min=x;
if (y<x && y<z)
y=min;
if (z<x && z<y)
z=min;
printf("min is : ", min);
return(0);
}
well this works too, but ı can not understand most of the programs in this forum
is there any place to learn how to write that " cout << ".... ; " thing or something like this :S
ty for helping this newcommer:)
/* sorry for my bad english ı hope u could understand what ı meant */
2008 scandalz.net
You or I must yield up his life to Ahrimanes. I would rather it were
you. I should have no hesitation in sacrificing my own life to spare
yours, but we take stock next week, and it would not be fair on the
company.
-- J. Wellington Wells