Hi!

I have another assignment regarding writing a program based on a given output.

Here's the Output given:

Output:

Enter your date of birth:
Day:
Month:
Year:

My birth date is on 31 August 1980.

So, here's my answer( Although it is wrong; with about 6 ERRORS in it):

#include <stdio.h>
main()
{
    char date of birth[15];
         printf("Enter your date of birth:");
         scanf("%s", date of birth);
    char Day[15]
         printf("Day:");
         scanf("%s", Day);
    char Month[15]
         printf("Month:");
         scanf("%s", Month);
    char Year[15]
         printf("Year:");
         scanf("%s", Year);
         printf("\n\nMy birth date is on %s\n", date of birth);
return 0;
}

So, this is SO NOT CORRECT, right???

Can anyone tell me where did I go wrong in writing this program code? Coz I got 6 ERRORS in it!!! :(

And it's due tomorrow too! BUMMER.

Please! Please! Please! S.O.S

p/s: I'm waiting patiently for a reply thread here ASAP. Thanks in advance.

And it's due tomorrow too! BUMMER.
Please! Please! Please! S.O.S
p/s: I'm waiting patiently for a reply thread here ASAP. Thanks in advance.

Please use code tags, and don't beg people for doing your homework...

As you say, there are 6 errors. What do these errors say? Often there are line numbers, so look in those lines, and solve the error.

If you have any specific question, I'd love to help you!

Please use code tags, and don't beg people for doing your homework...

As you say, there are 6 errors. What do these errors say? Often there are line numbers, so look in those lines, and solve the error.

If you have any specific question, I'd love to help you!

Emm..Okay. So.... HOW EXACTLY DO I CODE TAGS???

Anyway, I'm NOT BEGGING PEOPLE TO DO MY HOMEWORK..!!!!

If you could just read my thread post thoroughly, I did tried doing it myself, already.

I'm just saying that if someone could correct my mistakes...THAT'S ALL. DUH!

whats the mistakes that you receive?

OK, but I am not the person to trace your mistakes and correct them, YOU have to do that. I can only help you to understand HOW to correct them. I just gave you tips on how to do that in my first post.

Maybe you're not begging me to do your homework, but it comes close.

Code tags are put using the big button in the top of the editing screen, saying CODE (hard to make that up?).

Do you have any specific questions, about errors you are getting, the types of problems you run into, or one problem that needs explaining? I will help you.

Please use code tags, and don't beg people for doing your homework...

As you say, there are 6 errors. What do these errors say? Often there are line numbers, so look in those lines, and solve the error.

If you have any specific question, I'd love to help you!

#include <stdio.h>
main()
{
char date of birth[15], Day[15], Month[15], Year[15]; 
printf("Enter your date of birth:");
scanf("%s", date of birth);
printf("Day:");
scanf("%s", Day);
printf("Month:");
scanf("%s", Month);
printf("Year:");
scanf("%s", Year);
printf("\n\nMy birth date is on %s\n", date of birth);
return 0;
}

So, from the program that I tried writing above here, HERE ARE THE ERRORS THAT HAD SHOWN UP:

In LINE #4, ERROR SAYS: Declaration Syntax error.
In LINE #6, ERROR SAYS: Function Call Missing )
In LINE #8, ERROR SAYS: Undefined symbol 'Day'
In LINE #10, ERROR SAYS: Undefined symbol 'Month'
In LINE #12, ERROR SAYS: Undefined symbol 'Year'
In LINE #13, ERROR SAYS: Function Call Missing )

So, is this enough info for any of you guys out there to help me out????? Thanks in advance.

Super!

Now, when I try to build this code in my project, I get all these errors:

1>------ Build started: Project: TestProject, Configuration: Debug Win32 ------
1>Build started 18-10-2011 13:42:43.
1>PrepareForBuild:
1> Creating directory "D:\Documenten\C++\TestProject\Debug\".
1>InitializeBuildStatus:
1> Creating "Debug\TestProject.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1> Main.cpp
1>d:\documenten\c++\testproject\testproject\main.cpp(3): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\documenten\c++\testproject\testproject\main.cpp(4): error C2146: syntax error : missing ';' before identifier 'of'
1>d:\documenten\c++\testproject\testproject\main.cpp(4): error C2065: 'of' : undeclared identifier
1>d:\documenten\c++\testproject\testproject\main.cpp(4): error C2146: syntax error : missing ';' before identifier 'birth'
1>d:\documenten\c++\testproject\testproject\main.cpp(4): error C2065: 'birth' : undeclared identifier
1>d:\documenten\c++\testproject\testproject\main.cpp(4): error C2065: 'Day' : undeclared identifier
1>d:\documenten\c++\testproject\testproject\main.cpp(4): error C2065: 'Month' : undeclared identifier
1>d:\documenten\c++\testproject\testproject\main.cpp(4): error C2065: 'Year' : undeclared identifier
1>d:\documenten\c++\testproject\testproject\main.cpp(6): error C2146: syntax error : missing ')' before identifier 'of'
1>d:\documenten\c++\testproject\testproject\main.cpp(6): error C2059: syntax error : ')'
1>d:\documenten\c++\testproject\testproject\main.cpp(8): error C2065: 'Day' : undeclared identifier
1>d:\documenten\c++\testproject\testproject\main.cpp(10): error C2065: 'Month' : undeclared identifier
1>d:\documenten\c++\testproject\testproject\main.cpp(12): error C2065: 'Year' : undeclared identifier
1>d:\documenten\c++\testproject\testproject\main.cpp(13): error C2146: syntax error : missing ')' before identifier 'of'
1>d:\documenten\c++\testproject\testproject\main.cpp(13): error C2059: syntax error : ')'
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.88
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Also I see this in my window (I use Visual Studio 2010 Ultimate): See picture.

Super!

Now, when I try to build this code in my project, I get all these errors:


Also I see this in my window (I use Visual Studio 2010 Ultimate): See picture.

Hey Hiddepolen,

Are your comments helping me at all?

Hmm......Let's see....NOPE!!!

<snipped profanity> LAAA WEIYH!

commented: Not really being nice are you? -1
commented: People are trying to help you learn. If you can't respect that, you can bugger off! -1

>>char date of birth[15]

There can not be spaces in the object names. One way to code it is to replace spaces with _ character char date_of_birth[15]

I am just trying to help you man, try to find out some things for yourself!

Some tips:
- Dont use spaces in names (like the person above me said)
- Use int main () {} instead of main() {}

#include<stdio.h>
main()
{
   char date_of_birth, day, month, year[15]
       printf("Enter your date of birth:");

Dudes,

I'm down to 1 ERROR ONLY NOW!!!!

COOL~ness, huh :D

Anyway, the one remaining error left is on LINE #5, where the ERROR STILL SAYS: Declaration Syntax error.

Help, anyone? Please and thanks in advance :)

Look at my previous post, tip #2.
- Use int main(){} instead of main (){}.

Look at my previous post, tip #2.
- Use int main(){} instead of main (){}.

I did. Only there was not much of a difference in THAT part. Duh.

Any other brilliant suggestions?

#include<stdio.h>
main()
{
   char date_of_birth, day, month, year[15]
       printf("Enter your date of birth:");
#include<stdio.h>
int main()
{
   char date_of_birth, day, month, year[15]
       printf("Enter your date of birth:");

Find the difference...

#include<stdio.h>
main()
{
   char date_of_birth, day, month, year[15]
       printf("Enter your date of birth:");
#include<stdio.h>
int main()
{
   char date_of_birth, day, month, year[15]
       printf("Enter your date of birth:");

Find the difference...

OKAY. OKAY. I get your point. OKAY. So I added int main()....

So.....what?

THE ONE & ONLY REMAINING ERROR IS STILL IN THERE!!!!

And it's not on that LINE!!! IT'S ON LINE #5!!!! LOOK AT THE CODE, DEMNIT!

commented: Are you always such a jerk when asking others for help? -3
commented: DEMNIT -1

Please, talk a little nicer and a little more civilised. I know you can do it...

There is no ; at the end of your line... Can't you come up with that yourself?

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.