#include <iostream>

using namespace std;

int main()
const int pin1 = 123;
  const int accnum1= 23;
  int pin;
  int accnum;
    cout << "Enter Pin" <<endl;
    cin >> pin;
    cout << "Enter account number" <<endl;
    cin >> accnum;
    if (pin1 == pin) && (accnum1 == accnum) // line 15
            cout<<" you passed";
        return 0;

    it says there is an error at line 15(indicated)

Recommended Answers

All 4 Replies

Yes. It needs to be either of these two ways:

if (pin1 == pin && accnum1 == accnum)

or this

if ((pin1 == pin) && (accnum1 == accnum))

Also how can i concatenate a sentence with the output of a variable
eg. cout << "Your new balance is" << balance <<endl;

Assuming that balance is at least a floating point value, this is almost correct. Try this:

std::cout << "Your new balance is " << std::put_money((long double) balance) << std::endl;

Here is a good c++ reference: http://www.cplusplus.com/reference/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.