GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 06-Sep-2008, 15:59
Beginner Beginner is offline
New Member
 
Join Date: Sep 2008
Posts: 4
Beginner is on a distinguished road

Error C0265 'count' undeclared identifier


Hi, I'm a college student and need some help with my homework assignment.
the assignment is as follows:

Write a program that asks the user to enter his birth date in three different lines (day,
month, year). The program should then display in three separate lines how many years,
months and days have passed from the birth date to the due date of the assignment...

I only been in this class for a week, I joined it late and my assignment is due this Monday.

So far, I'm trying to solve the first part first but keep getting an error C0265 'count' undeclared identifier

This is what i got:

CPP / C++ / C Code:
#include<iostream>
using namespace std;
int main ()
{
	int d, y;
	char m;

	cout<< "Enter the d, m, y of your birthday:";
	cin >> d;
	cin >> y;
	cin >> m;
	
	cout<< 

	return 0;
}

THIS IS MY FIRST POST

ANY HELP WOULD BE GREATLY APPRECIATED
Last edited by admin : 06-Sep-2008 at 18:40. Reason: Please insert your example C/C++ codes between [CPP] and [/CPP] tags
  #2  
Old 06-Sep-2008, 20:26
Howard_L Howard_L is online now
Regular Member
 
Join Date: Apr 2007
Location: Maryland/PA, USA
Posts: 800
Howard_L is a jewel in the roughHoward_L is a jewel in the roughHoward_L is a jewel in the rough

Re: Error C0265 'count' undeclared identifier


I don't know where 'count' comes from , I don't see it in what you posted.
But I do see an incomplete 'cout << ' statement. You need to :
CPP / C++ / C Code:
  cout << "something, like this text or a var: d= " << d << endl; 
  #3  
Old 08-Sep-2008, 14:55
msm1593 msm1593 is offline
Junior Member
 
Join Date: Jan 2007
Posts: 32
msm1593 is on a distinguished road

Re: Error C0265 'count' undeclared identifier


I don't know if this is actually of any help or not, but when i first started writing C++ I used to constantly mis-type 'cout' as 'count', maybe that is where that error came from
  #4  
Old 08-Sep-2008, 15:12
Beginner Beginner is offline
New Member
 
Join Date: Sep 2008
Posts: 4
Beginner is on a distinguished road

Re: Error C0265 'count' undeclared identifier


actually i did do that but then i corrected it.

then i try to build it and it gave me the same error


i use visual 2005 compiler.
  #5  
Old 08-Sep-2008, 15:39
ocicat ocicat is offline
Regular Member
 
Join Date: May 2008
Posts: 580
ocicat is a jewel in the roughocicat is a jewel in the rough

Re: Error C0265 'count' undeclared identifier


Quote:
Originally Posted by Beginner
...i try to build it and it gave me the same error
You should verify what code you are actually compiling. As Howard_L stated earlier, the code posted in your initial message is not syntactically complete, nor is any variable by the name of count defined.
  #6  
Old 08-Sep-2008, 19:16
Howard_L Howard_L is online now
Regular Member
 
Join Date: Apr 2007
Location: Maryland/PA, USA
Posts: 800
Howard_L is a jewel in the roughHoward_L is a jewel in the roughHoward_L is a jewel in the rough

Re: Error C0265 'count' undeclared identifier


Yes, it is very important to post exactly :
- your code (so we can compile and run it and compare with your comments)
- the output from compiling (and use the maximum warning settings when compiling)
... and if it runs and has a problem:
- post the part ot the output which domonstrates the problem too.
Don't be shy about it, we were all beginners at one time.
Make sense?
  #7  
Old 09-Sep-2008, 00:13
Beginner Beginner is offline
New Member
 
Join Date: Sep 2008
Posts: 4
Beginner is on a distinguished road

Re: Error C0265 'count' undeclared identifier


thanks guys for the input
i was able to get a tutor online to help me solve my problem, last night
im not sure why i kept getting "count" errors, if i didnt have it on the solution file, maybe i clear the error lists and create a new file.

this is the code i came up with, it was to determine month, day, year from assignment due date.

i already turned it in, so, if im wrong oh well, i got assignment 2 already.
thanks for the help again

CPP / C++ / C Code:
// Header Files
#include<iostream>
using namespace std;

int main()
{
    int td,tm,ty,d,m,y,bm,by,bd;


    td=8;
    tm=9;
    ty=2008;
    cout<<"\nToday's date(dd mm yyyy) : ";
    cout<<td<<" "<<tm<<" "<<ty<<endl;
    cout<<"\nEnter birth date : ";
    cout<<"\nDate : ";
    cin>>d;
    cout<<"\nMonth : ";
    cin>>m;
    cout<<"\nYear : " ;
    cin>>y;


    //Year  Calculations
    if(tm>m)
    by = ty-y;
    else if(tm==m)

{
	if(td>=d)
	by=ty-y;
}

    else
    by = (ty-y)-1;


    //Month  Calculations
    if(tm>m)
    bm=tm-m;
    else if(tm==m)


{
	if(td>=d)
	bm=0;
}

    else
    bm=12-(m-tm);


    //Date Calculations
    if(td>d)
    bd=td-d;
    else if(td<d)
    bd=30-(d-td);
    else if(td==d)
    bd=0;

    // Final result

    cout<<"\n\n\nResult"<<endl;
    cout<<"\nDays = "<<bd<<endl;
    cout<<"\nMonths = "<<bm<<endl;
    cout<<"\nYears = "<<by<<endl;
    
    return 0;
}
Last edited by LuciWiz : 17-Sep-2008 at 07:35. Reason: Please insert your C++ code between [cpp] & [/cpp] tags
  #8  
Old 09-Sep-2008, 00:16
Beginner Beginner is offline
New Member
 
Join Date: Sep 2008
Posts: 4
Beginner is on a distinguished road

Re: Error C0265 'count' undeclared identifier


actually i did mispell "cout" with "count",
once i fixed the error it was still showing up though, weird
 
 

Recent GIDBlogAccepted for Ph.D. program by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Circular Linked Queue Copy Constructor and Assignment Operator Not Working? wc3promet C++ Forum 1 06-Oct-2008 04:00
Assignment Operator and Pointer Peter_APIIT C++ Forum 14 25-Sep-2007 06:36
double concatenated dynamic list - different type assignment warning dlp C Programming Language 11 01-Jun-2007 08:59
Am I reading this assignment correctly? earachefl C++ Forum 2 09-May-2006 10:39
Not sure I understand this assignment.... earachefl C++ Forum 7 05-May-2006 17:12

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 10:16.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.