init - 'does not name type' error in small survey app C++ [closed]
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;
}
c++
closed as off-topic by llllllllll, rsjaffe, πάντα ῥεῖ, eyllanesc, Gábor Bakos Nov 24 '18 at 8:23
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – llllllllll, rsjaffe, πάντα ῥεῖ, eyllanesc, Gábor Bakos
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
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;
}
c++
closed as off-topic by llllllllll, rsjaffe, πάντα ῥεῖ, eyllanesc, Gábor Bakos Nov 24 '18 at 8:23
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – llllllllll, rsjaffe, πάντα ῥεῖ, eyllanesc, Gábor Bakos
If this question can be reworded to fit the rules in the help center, please edit the question.
7
int main()
notinit main()
:-)
– TrebuchetMS
Nov 24 '18 at 6:42
You are also missing a;
at the end of line 10.
– Swordfish
Nov 24 '18 at 6:58
@Swordfish Not to mention that anint
can't be properly initialized with aconst char*
at all.
– πάντα ῥεῖ
Nov 24 '18 at 7:49
add a comment |
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;
}
c++
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;
}
c++
c++
edited Nov 24 '18 at 6:58
Swordfish
9,81011436
9,81011436
asked Nov 24 '18 at 6:42
Beat Emirates - JohnBeat Emirates - John
31
31
closed as off-topic by llllllllll, rsjaffe, πάντα ῥεῖ, eyllanesc, Gábor Bakos Nov 24 '18 at 8:23
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – llllllllll, rsjaffe, πάντα ῥεῖ, eyllanesc, Gábor Bakos
If this question can be reworded to fit the rules in the help center, please edit the question.
closed as off-topic by llllllllll, rsjaffe, πάντα ῥεῖ, eyllanesc, Gábor Bakos Nov 24 '18 at 8:23
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – llllllllll, rsjaffe, πάντα ῥεῖ, eyllanesc, Gábor Bakos
If this question can be reworded to fit the rules in the help center, please edit the question.
7
int main()
notinit main()
:-)
– TrebuchetMS
Nov 24 '18 at 6:42
You are also missing a;
at the end of line 10.
– Swordfish
Nov 24 '18 at 6:58
@Swordfish Not to mention that anint
can't be properly initialized with aconst char*
at all.
– πάντα ῥεῖ
Nov 24 '18 at 7:49
add a comment |
7
int main()
notinit main()
:-)
– TrebuchetMS
Nov 24 '18 at 6:42
You are also missing a;
at the end of line 10.
– Swordfish
Nov 24 '18 at 6:58
@Swordfish Not to mention that anint
can't be properly initialized with aconst char*
at all.
– πάντα ῥεῖ
Nov 24 '18 at 7:49
7
7
int main()
not init main()
:-)– TrebuchetMS
Nov 24 '18 at 6:42
int main()
not init main()
:-)– TrebuchetMS
Nov 24 '18 at 6:42
You are also missing a
;
at the end of line 10.– Swordfish
Nov 24 '18 at 6:58
You are also missing a
;
at the end of line 10.– Swordfish
Nov 24 '18 at 6:58
@Swordfish Not to mention that an
int
can't be properly initialized with a const char*
at all.– πάντα ῥεῖ
Nov 24 '18 at 7:49
@Swordfish Not to mention that an
int
can't be properly initialized with a const char*
at all.– πάντα ῥεῖ
Nov 24 '18 at 7:49
add a comment |
1 Answer
1
active
oldest
votes
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++,
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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++,
add a comment |
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++,
add a comment |
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++,
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++,
answered Nov 24 '18 at 6:53
TrebuchetMSTrebuchetMS
2,73611023
2,73611023
add a comment |
add a comment |
7
int main()
notinit main()
:-)– TrebuchetMS
Nov 24 '18 at 6:42
You are also missing a
;
at the end of line 10.– Swordfish
Nov 24 '18 at 6:58
@Swordfish Not to mention that an
int
can't be properly initialized with aconst char*
at all.– πάντα ῥεῖ
Nov 24 '18 at 7:49