fixed errors
This commit is contained in:
		
							
								
								
									
										33
									
								
								lab9/26.cpp
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								lab9/26.cpp
									
									
									
									
									
								
							@@ -2,27 +2,30 @@
 | 
				
			|||||||
using namespace std;
 | 
					using namespace std;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template <typename T,
 | 
					template <typename T,
 | 
				
			||||||
          typename = std::enable_if_t<std::is_arithmetic<T>::value, T>>
 | 
					          typename = enable_if<is_arithmetic<T>::value, T>>
 | 
				
			||||||
class Foo {
 | 
					class Foo
 | 
				
			||||||
  T x, y;
 | 
					{
 | 
				
			||||||
 | 
					    T x, y;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  Foo() {
 | 
					    Foo()
 | 
				
			||||||
    cout << "x: ";
 | 
					    {
 | 
				
			||||||
    cin >> x;
 | 
					        cout << "x: ";
 | 
				
			||||||
    cout << "y: ";
 | 
					        cin >> x;
 | 
				
			||||||
    cin >> y;
 | 
					        cout << "y: ";
 | 
				
			||||||
  }
 | 
					        cin >> y;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ~Foo() { cout << "Destructor called, nothing to do here."; }
 | 
					    ~Foo() { cout << "Destructor called, nothing to do here."; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  T mx() { return (x > y ? x : y); };
 | 
					    T mx() { return (x > y ? x : y); };
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int main() {
 | 
					int main()
 | 
				
			||||||
  Foo<float> bar;
 | 
					{
 | 
				
			||||||
 | 
					    Foo<float> bar;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  cout << bar.mx() << endl;
 | 
					    cout << bar.mx() << endl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user