Reply embedded...

> -----Original Message-----
> From: darkshadow_x21 [mailto:[EMAIL PROTECTED]
> Sent: Monday, January 10, 2005 9:12 AM
> To: [email protected]
> Subject: [C-Paradise] Structure problem help
> 
> 
> 
> hi i am a high school student and i am having trouble figuring out
> the current problem i am working on. here it is. for some reason i
> get problems when entering more than one value per variable and i
> already tried cin.get it just skips other fields when i use it.
> 
> #include <iostream.h>
           ^^^^^^^^^^^
Should be <iostream>

Names in C++ Standard Library are in 'std' namespace.  For very trivial
program, use:
    using namespace std;


> struct address_info
> {
>  string name_1st[20];
   ^^^^^^
What is 'string'?  Is it std::string?  

If 'string' is char, then:
1.  You are not really taking advantage of C++.  
2.  You're using a reserved name.  Any identifier begin with 'str' is
reserved.


>  string name_mid[2];
>  string name_last[20];
>  string home_address[30];
>  string city[20];
>  string state[2];
>  string zip_code[10];
>  string country[20];
>  string phone[20];
>  string email[30];
> };
> 
> void main ()
  ^^^^
   int main()

> {
>  address_info person1;
> 
>  cout<<"Enter First Name:"<<endl;
>  cin.get.get(person1.name_1st);
   ^^^^^^^^^^^^
Wrong use of 'get'.

For char* or char[], you have to specify the size of the array:
    char name[20];
    cin.get(name, sizeof name);

For std::string:
    std::string name;
    cin >> name;

[rest of codes snipped]

HTH
Shyan





>-----------------------------------------~-~>
CHECK THE ARCHIVE BEFORE POSTING!!!! Archive is available at 
http://www.eScribe.com/software/C-Paradise/

>------------------------------------------_->


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/C-Paradise/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to