Q&A Discussions
If except can handle common errors very well, doesn't that make the use of raise redundant inside of a try-except block?
For example:
try:
print( 5 / 0 )
except ZeroDivisionError:
raise ValueError("An error occurred!")
What's the difference if we handle it this way:
try:
print( 5 / 0 )
except (ZeroDivisionError, ValueError):
print("An error occurred!")
3 Votes
2 Answersif i download the programs for c++ on my pc ( codebuilds and the compiler ) and i want to write a program in my package ( workspace ) i create a new file and write smthing beginning
#include <iostream>
using namespace std;
int main ()
{
...
}
and i want to run it, it always runs this first program : Hello World. and not my written program how can i run just my written program ?
have i maybe to write anything else as
int main () {} ?
0 Votes
16 AnswersCan someone explain this code to me....
class ReverseNumberDemo
{ public static void main(String args[]) {
int num=123456789;
int reversenum =0;
while( num != 0 ) {
reversenum = reversenum * 10;
reversenum = reversenum + num%10;
num = num/10; }
System.out.println("Reverse of specified number is: "+reversenum);
}
}
the thing I don't get is the reversenum part......isn't reversenum=0 so wouldn't reversenum*10=0
0 Votes
8 Answershow can i put a program in an application ? i wrote a program with eclipse ( a calculator ) what can i do with it now ? maybe put it in an application but how ?
and is in this app (sololearn) declared how to program interactive fields ? like for calculator a field for + - * / and = ? is there any tutorial for that ?
2 Votes
5 AnswersWrite a program that uses a dynamic array that contains 5 items of double values. The size of the array is entered when the program is run. Aldo the 5 values must be entered. These tasks are done in the main ( ) function. Then write a function to display the 5 values. The function must have a pointer variable as a parameter. The function is called from the main ( ).
0 Votes
2 AnswersHot today
Javascript
3 Votes
Fitting
0 Votes
Why text takes time to load
1 Votes
Digital currency
1 Votes