Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5fba58d

Browse files
committed
update 6th example of 'User-Input' in C++
1 parent6723593 commit5fba58d

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

‎a.out‎

-48 Bytes
Binary file not shown.

‎example06.cpp‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,20 @@ int main(){
1515
cout<<"Sum is" << x/y <<endl;
1616
}
1717

18-
// ==================== Best Way ===============
18+
// ==================== Best Way ===============
19+
#include<iostream>
20+
usingnamespacestd;
21+
intmain(){
22+
float x;
23+
float y;
24+
cout<<"Enter 1st Number :";
25+
cin>> x;
26+
cout <<"Enter 2nd Number :";
27+
cin>> y;
28+
if(y==0){
29+
cout<<"Error: Division by zero is not allowed!" << endl;
30+
}else{
31+
cout <<"Result of division:" << x / y << endl;
32+
}
33+
return0;
34+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp