Sponsored Content
Full Discussion: enum in c++
Top Forums Programming enum in c++ Post 302310474 by Corona688 on Saturday 25th of April 2009 01:17:06 AM
Old 04-25-2009
Good question.
Code:
#include <iostream>
#include <stdio.h>
using namespace std;

typedef struct A
{
    enum a{ red,blue,green}a;

}obj11;
obj11 obj1;
int main()
{
    obj1.a=A::red;
    //obj1.a=red;          // how to set variable ?
    cout<<"sizeof struct is n "<<sizeof(obj1)<<"\n";
    cout<<"obj1.a is "<<obj1.a<<"\n";
    if (obj1.a == A::red)   // here i want to use comparison with red  
        cout<<"Hi\n";
    else
        cout<<"bye\n";

    return 0;
}

 

5 More Discussions You Might Find Interesting

1. Programming

what is the base type of enum

helo i have asked in exam what that what is the base type of enum options are given bewlo (1) long int (2) short int (3) signed int (4) unsigned int can u tell me what is the exact answer from the above option Regards, Amit (1 Reply)
Discussion started by: amitpansuria
1 Replies

2. IP Networking

DNS ENUM RR interpretation

Hi Guys, This is really really urgent. Am looking out for some quick answers. I'm developing a DNS Resolver client that interprets DNS Query repsonses & pass on the needful to DNS applications. When an ENUM query(modified to an nslookup naptr query) is issued & an NAPTR RR(Resource Record)... (1 Reply)
Discussion started by: smanu
1 Replies

3. Programming

enum and C preprocessor

Say I have a list of enumerations I wish to use to select a variable at compile-time: enum pins { PIN_A=1, PIN_B=7, PIN_C=6, } int VAR1, VAR2, VAR3, VAR4, VAR5, VAR6, VAR7; #define PIN_TO_VAR(NUM) VAR ## NUM int main(void) { PIN_TO_VAR(PIN_A)=32;... (2 Replies)
Discussion started by: Corona688
2 Replies

4. Programming

C- trying to code a 'spare array'; 'enum' fauled.

I am trying to implement a spare array in C that would be referenced by regular integers. Right away: define array for maximum possible index elements completely is not what I trying to get!!! It should be a construction that would have just 2 elements if I need to have just two indexes, like... (8 Replies)
Discussion started by: alex_5161
8 Replies

5. Programming

Mixed enum types - coverity defect

Hi All, I came across this error "MIXING ENUM TYPES" when I run my C program against the Coverity Tool. I've made many search relating to the error, but I didnt find the exact solution. Can anyone help me to overcome this.? Thanks in Advance.!! (3 Replies)
Discussion started by: Parameswaran
3 Replies
std::__detail::_Scanner< _InputIterator >(3)		     Library Functions Manual		      std::__detail::_Scanner< _InputIterator >(3)

NAME
std::__detail::_Scanner< _InputIterator > - SYNOPSIS
Inherits std::__detail::_Scanner_base. Public Types typedef std::iterator_traits < _IteratorT >::value_type _CharT" typedef const std::ctype< _CharT > _CtypeT typedef regex_constants::syntax_option_type _FlagT" typedef _InputIterator _IteratorT typedef unsigned int _StateT typedef std::basic_string< _CharT > _StringT enum _TokenT { _S_token_anychar, _S_token_backref, _S_token_bracket_begin, _S_token_bracket_end, _S_token_inverse_class, _S_token_char_class_name, _S_token_closure0, _S_token_closure1, _S_token_collelem_multi, _S_token_collelem_single, _S_token_collsymbol, _S_token_comma, _S_token_dash, _S_token_dup_count, _S_token_eof, _S_token_equiv_class_name, _S_token_interval_begin, _S_token_interval_end, _S_token_line_begin, _S_token_line_end, _S_token_opt, _S_token_or, _S_token_ord_char, _S_token_quoted_char, _S_token_subexpr_begin, _S_token_subexpr_end, _S_token_word_begin, _S_token_word_end, _S_token_unknown } Public Member Functions _Scanner (_IteratorT __begin, _IteratorT __end, _FlagT __flags, std::locale __loc) void _M_advance () _TokenT _M_token () const const _StringT & _M_value () const Static Public Attributes static constexpr _StateT _S_state_at_start static constexpr _StateT _S_state_in_brace static constexpr _StateT _S_state_in_bracket Detailed Description template<typename _InputIterator>class std::__detail::_Scanner< _InputIterator > struct _Scanner. Scans an input range for regex tokens. The _Scanner class interprets the regular expression pattern in the input range passed to its constructor as a sequence of parse tokens passed to the regular expression compiler. The sequence of tokens provided depends on the flag settings passed to the constructor: different regular expression grammars will interpret the same input pattern in syntactically different ways. Definition at line 65 of file regex_compiler.h. Member Enumeration Documentation template<typename _InputIterator> enum std::__detail::_Scanner::_TokenT Token types returned from the scanner. Definition at line 75 of file regex_compiler.h. Author Generated automatically by Doxygen for libstdc++ from the source code. libstdc++ Tue Jun 10 2014 std::__detail::_Scanner< _InputIterator >(3)
All times are GMT -4. The time now is 05:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy