0

My program isnt running please give suggestions

#include <iostream> using namespace std; int main() { int v,h; cout<< "enter number of valence electrons"; cin>>v; if(v<=8){ h=v/2; } else{ h=v/8+(v%8)/2; } if(h=2){ cout<<"sp Hybridization"; } else if(h=3){ cout<<"sp² Hybridization"; } else if(h=4){ cout<<"sp³ Hybridization"; } else if(h=5){ cout<<"sp³d Hybridization"; } else if(h=6){ cout<<"sp³d² Hybridization"; } else if(h=7){ cout<<"sp³d³ Hybridiz

8th Oct 2017, 6:51 AM
Waseem Ansari
Waseem Ansari - avatar
6 odpowiedzi
+ 13
Complete revision #include <iostream> using namespace std; int main() { int v,h; cout << "enter number of valence electrons: "; cin >> v; if (v <= 8) h = v / 2; else h = v / 8 + (v % 8) / 2; if (h == 2) cout << "sp Hybridization\n"; else if (h == 3) cout << "sp^2 Hybridization\n"; else if (h == 4) cout << "sp^3 Hybridization\n"; else if (h == 5) cout << "sp^3 d Hybridization\n"; else if (h == 6) cout << "sp^3 d^2 Hybridization\n"; else if (h == 7) cout << "sp^3 d^3 Hybridiz\n"; } Feel free and ask your questions.
8th Oct 2017, 7:05 AM
Babak
Babak - avatar
+ 5
if(something == otherthing)
8th Oct 2017, 6:55 AM
Meharban Singh
Meharban Singh - avatar
+ 3
What!?
8th Oct 2017, 7:01 AM
Meharban Singh
Meharban Singh - avatar
0
1 more question
8th Oct 2017, 6:59 AM
Waseem Ansari
Waseem Ansari - avatar
0
how can I make it's output
8th Oct 2017, 6:59 AM
Waseem Ansari
Waseem Ansari - avatar