#include<iostream>
using namespace std;
int main()
{
int a,b,c,a2,b2,c2,d;
cout<<"Enter Your Date Of Birth";
cout<<"day(in 2 digits)=";
cin>>a;
cout<<"month(in 2 digits)=";
cin>>b;
cout<<"year(in 4 digits)=";
cin>>c;
a2=(a%10)+(a/10);
b2=(b%10)+(b/10);
(line 15)c2=(c/1000)+[(c%1000)/100]+{[(c%1000)%100]/10}+{[(c%1000)%100]%10};
d=a2+b2+c2;
cout<<d;
cin>>a
cin>>b
cin>>c;
}
i was making a program in dev c++ to calculate lucky number... the formula is sum of all the digits of the birth date including year... so making the program it is showing 5 errors... errors are as follow:-
(line)15 (message)expected primary-expression before '[' token
(line)15 (message)expected primary-expression before '{' token
(line)15 (message)expected `;' before '{' token
(line)15 (message)expected primary-expression before '{' token
(line)15 (message)expected `;' before '{' token
Anyways - use multiple brackets like this ((( ))), [ and { are reserved in C++.
And do NOT use Dev C++, unless your professor forces you to do so. And if he does, google why you're not supposed to use DevC++ and hold hima speech about it.
This is a dev C++ thing? I've never used it, but I know of its bad reputation. What does it do? Allow these in the code and then silently swap them out, or does it come with some kind of mutant compiler?
Despite it's reputation, it's not that bad. You do know by now that programmers tend to be sarcastic and exaggerate? It is outdated and therefore slightly off the standard, and it has some bugs that will likely never be fixed, although I've never encountered them, but it's not that bad of an IDE, at least until you get a better one. Try Code::Blocks, wxDev-C++, Microsoft Visual C++...