Dev C++ Expected Initializer Before Token

Dev C++ Expected Initializer Before Token 9,6/10 5905 votes
P: 3
I am currently doing online tutorials for C++, and am pretty much stuck in a rut about this problem. It is saying that there's an expected unqualifed-id before '{' token (I will post the code in just a second) on line 11, and an expected ',' or ';' before '{' token also on line 11, however I don't have a clue what the first one means. The program is meant to save a user's name in a string variable within a structure, and to then show that name without the need to assign a pointer to it. Also, note that I am compiling this with the Dev-C++ (aka Devcpp) compiler, on a Windows XP system.
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. struct database {
  6. string name; // declares that the structure has a string
  7. // in it called name.
  8. }
  9. {
  10. int main()
  11. cout<<'Enter your name.n'; //displays the obvious
  12. getline(cin, name, 'n'); // records the user's input into the string name,
  13. // and terminates the command when the user presses enter.
  14. database employee01;
  15. // declares the single structure and its contents
  16. employee01.name = string name;
  17. cout<<'Your name should be: '<<employee01.name<<'.n';
  18. cin.get();
  19. }
  20. }
11 C:Documents and SettingsMainMy Documentssubstring and structures.cpp expected unqualified-id before '{' token
11 C:Documents and SettingsMainMy Documentssubstring and structures.cpp expected `,' or `;' before '{' token
Could someone please explain to me what the 'unqualified-id before' means, how to fix it, what I did wrong, and why it is the way that you say is the correct code?

Dev C++ Expected Initializer Before Tokens

P: n/a
perhaps this will simplify. below is the header and then the
implementation
#ifndef BIGINT_ABROWNIN
#define BIGINT_ABROWNIN
#include <iostream> //provides istream and ostream
#include <cstdlib> // provides size_t
namespace abrowning6 {
class BigInt {
public:
//TYPEDEFS and MEMBER CONSTANTS
typedef std::size_t size_type;
typedef int value_type;
static const size_type CAPACITY = 100;
//CONSTRUCTOR
BigInt ();
//MODIFICATION MEMBER FUNCTIONS
void insert(const value_type& entry);
void erase_all();
//CONSTANT MEMBER FUNCTIONS
size_type size() const { return used;}
bool is_item () const;
value_type current() const;
int getB1() const {return big_int1;}
int getB2() const {return big_int2;}
friend std::ostream & operator <<
(std::ostream & outs, const BigInt & source);
friend std::istream & operator >>
(std::istream & ins, const BigInt & target);
private:
value_type data[CAPACITY];
size_type used;
size_type current_index;
int sign;
int big_int1;
int big_int2;
};
// NONMEMBER FUNCTIONS for the big_int class
BigInt operator + (const BigInt& big_int1, const BigInt&
big_int2);
BigInt operator - (const BigInt& big_int1, const BigInt&
big_int2);
BigInt operator * (const BigInt& big_int1, const BigInt&
big_int2);
BigInt operator / (const BigInt& big_int1, const BigInt&
big_int2);
BigInt operator % (const BigInt& big_int1, const BigInt&
big_int2);
}
#endif //BIGINT_H
#include <cassert> //provides assert
#include 'big_int.h'
#include <cstdlib>
#include <iostream>
namespace abrowning6 {
BigInt::BigInt()
:used(0),
current_index(0),
sign (+1),
big_int1(0),
big_int2(0)
{// Constructor has no work to do
}
const BigInt::size_type BigInt::CAPACITY;
void BigInt::insert(const value_type& entry){
assert (size() < CAPACITY);
data[used] = entry;
++ used;
}
void BigInt::erase_all(){
used = 0;
}
BigInt operator + (const BigInt& big_int1, const BigInt&
big_int2){
assert (big_int1.size() + big_int1.size() <= BigInt::CAPACITY);
return
big_int1 + big_int2;
}
BigInt operator - (const BigInt& big_int1, const BigInt& big_int2){
return
big_int1 - big_int2;
}
BigInt operator * (const BigInt& big_int1, const BigInt& big_int2){
assert (big_int1.size() * big_int2.size() <= BigInt::CAPACITY);
return
big_int1 * big_int2;
}
BigInt operator / (const BigInt& big_int1, const BigInt& big_int2){
return
big_int1 / big_int2;
}
BigInt operator % (const BigInt& big_int1, const BigInt&
big_int2){
BigInt modulus;
return
big_int1 % big_int2;
}
friend ostream & operator <<(ostream & outs, const BigInt&
big_int1){
outs << big_int1.get_b1() << ' ' << big_int1.get_b2();
return outs;
}
friend istream & operator >>(istream & ins, const BigInt&
big_int1){
ins >> target.big_int1 >> target.big_int2;
return ins;
}
}
1,5 Top

Error Expected Initializer Before Int

Feb 11, 2012  Here's the whole code: / A basic example of Win32 programmiwng in C. This source code is in the PUBLIC DOMAIN and has NO WARRANTY. Colin Peters colin@bird.fu.is.saga-u.ac.jp./. Include include include. Sep 22, 2016  評価を下げる理由を選択してください. プログラミングに関係のない質問 やってほしいことだけを記載した丸投げの質問 問題・課題が含まれていない質問 意図的に内容が抹消された質問 過去に投稿した質問と同じ内容の質問 広告と受け取られるような投稿. Jun 12, 2007  I am currently doing online tutorials for C, and am pretty much stuck in a rut about this problem. It is saying that there's an expected unqualifed-id before ' token (I will post the code in just a second) on line 11, and an expected ',' or ';' before ' token also on line 11, however I don't have a clue what the first one means. HELP error expected unqualified-id before ' token How can I solve this error: expected unqualified-id at end of input Expected uniqualified-id before ' token HELP. Just looking at this very complex for loop that whole thing looks to be a for loop condition so where is the code that is executed upon each iteration? Feb 20, 2017  //Backlight (Timer 1 OCR1B) Test SBM 1 volatile int fastPin = 19; // IDE pin 07 - Port PC4 - ATMega328 pin 27 volatile int slowPin = 18; // IDE pin 08 - Port PC5 - ATMega328 pin 28. Jul 24, 2018  It literally means what it's saying. You're missing an important parenthesis there, bud. Check your code before you hit the semicolon. Little snitch netbiosd high port. Are there any missing close parenthesis there? Here's an example: codeprintf('Missing a parenthesis?'

Nov 09, 2019  Visit Bloodshed Dev C site and Download Bloodshed Dev C Latest Version! Why Download Bloodshed Dev C using YepDownload? Bloodshed Dev C Simple & Fast Download! Works with All Windows (64/32 bit) versions! Bloodshed Dev C Latest Version! Fully compatible with Windows 10; Disclaimer Bloodshed Dev C is a product developed by Free. Dev-C 4 Dev-C is a full-featured integrated development environment (IDE), which is able to create Windows or console-based C/C programs using the Mingw compiler system (version MSVCRT 2.95.2-1 included with this package), or the Cygwin compiler. Download bloodshed dev c windows, bloodshed dev c windows, bloodshed dev c windows download free. Dev-C Bloodshed Dev-C is a full-featured Integrated Development Environment (IDE) for the C/C programming language. It uses Mingw port of GCC (GNU Compiler Collection) as it's compiler. Dev-C can also be used in combination with Cygwin or any other GCC based compiler. Free Software (GPL) For Windows 95, 98, NT, 2000, XP. It was originally developed as an open-source fork of the Bloodshed Dev-C IDE. Installation and Use Even though DEV-C is filled with advanced compiler, debugger and a wide array of dev tools, it’s installation package is quite small (only around 50 MB) and therefore can be easily installed on any modern Windows PC or laptop.