0

Check this out.I could not get exact output

#include<iostream> using namespace std; class notebook{ private: string bookname; int id; int price; public: notebook() { bookname; id; price; } int getprice() { return price; } void display() { cout<<"enter details"<<endl; cout<<"enter bookname"<<endl; cin>>bookname; cout<<"enter id"<<endl; cin>>id; cout<<"enter price"<<endl; cin>>price; } }; class notebook2 { private: string bookname; int id; int price; public: notebook2() { bookname; id; price; } int getprice() { return price; } void display() { cout<<"enter details of sacond car"<<endl; cout<<"enter bookname"<<endl; cin>>bookname; cout<<"enter id"<<endl; cin>>id; cout<<"enter price"<<endl; cin>>price; } }; int main() { notebook n1; notebook2 n2; int p1,p2,sum; p1=n1.getprice(); p2=n2.getprice(); sum=p1+p2; if(sum%2==0) cout<<"sum is even"<<endl; n2.display(); if(sum%2==!0) cout<<"sum is odd"<<en

27th Mar 2020, 3:16 PM
Haider Ali
3 Answers
+ 1
Why you always tag your thread by numbers? can't you put something more relevant in the tags? Save the code and share the link. Your code is rather big, and it gets truncated due to character limits. Something you wouldn't need to worry about had you shared a saved code link instead. https://www.sololearn.com/post/75089/?ref=app
27th Mar 2020, 3:35 PM
Ipang
+ 1
I don't even what actually tag is?
27th Mar 2020, 5:30 PM
Haider Ali
+ 1
Haider Ali When we create a new thread, there's this "Relevant Tags" entry. We can fill this input field with words relevant to our thread topic. It can be used to improve context clarity, by language, subject or both. For example, when we ask about array in C++ language, we can write 'C++ array' in the "Relevant Tags" field, where C++ and array is relevant language, and subject, respectively. Perhaps you wonder why bother. The words in tags are used in SoloLearn search facility, the search engine matches the search terms to threads' tags. Placing irrelevant words in tags makes it difficult to search, because there are threads tagged with C++ which does not carry any relevance to the language. Meaning low quality search results.
27th Mar 2020, 5:53 PM
Ipang