-4

Trying to run and compile keeps getting . I've just started learning C++.

Is there something else i need to add to make this program run?

error: 'init' does not name a type


#include <iostream>

using namespace std;

init main()
{
    int name;
    int number;
    int email;
    int success = "Your information was successfully submitted"
    std::cout << "Please enter your name" << std::endl;
    std::cin >> name;
    std::cout << "Please enter your Phone number" << std::endl;
    std::cin >> number;
    std::cout << "And Finally, enter your email address" << std::endl;
    std::cin >> email;
    std::cout << success << std::endl;
    return 0;
}
Swordfish
  • 1
  • 3
  • 17
  • 42

1 Answers1

0

In your code, you have

init main()

this should be

int main()

Since main() is a function (and since this is C++, so it requires a return type), the compiler would check if init is a valid type. It is not. So an error is thrown.

error: 'init' does not name a type

Read more: what should main return in C and C++,

TrebledJ
  • 7,200
  • 7
  • 20
  • 43