subject

Circle all syntax errors and logic errors in following code, and correct it. there will be more than 14 errors. one correction earns one point until all 14 points are rewarded. however, if the student mark a correct place as wrong and change it, one point will be reduced.
include
using namespace std
int main()
{
int n;
sum = 0;
cout > > "enter a positive integer n: ";
cin < < n; while(n < = 0)
{
cout < < "wrong input. enter a positive integer n: " cin > > n;
}
int i = 1;
// initialization while(i < =n)
//check condition
{
sum += i; i+;
//increase i by 1
}
switch(n)
{
case 1:
cout < < "the sum is" < < sum < < endl;
case 2:
cout < < "the sum of 1+"
break; case 3
cout < < "the sume of 1+2+" < break;
default:
cout < < "the sum of 1+2++" < system(pause);
return 0; }

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 16:50
Consider a slotted aloha system, where the time slot equals the fixed duration of each packet. assume that there are 4 stations a,b,c,d sharing the medium. (a) stations a,b,c,d receive one packet each from higher layers at times 1.3, 1.5, 2.6,5.7 respectively. show which transmissions take place when, according to the slottedaloha protocol; describe all transmissions until all four packets have been successful.when needed, each station has access to the following sequence of random number, provided by a random number generator and drawn uniformly between 0 and 1: (1) station a draws numbers: 0.31, 0.27, 0.78, 0.9, 0.9, 0.11, 0. (2) station b draws numbers: 0.45, 0.28, 0.11, 0.83, 0.37, 0.22, 0. (3)station c draws numbers: 0.1, 0.2, 0.3, 0.4, 0. (4) station d draws numbers: 0.36, 0.77, 0.9, 0.1, 0.1, 0.1, 0.1, 0. (b) in slotted aloha, a station transmits in each time slot with a given probability. what probabilities would you assign to each of the four stations so as to: (i) maximize the efficiency of the protocol? (ii) maximize fairness among the four stations? (c) will the efficiency increase or decrease if we modify slotted aloha as follows: (i) get rid of slots and allow stations to transmit immediately? (ii) implement carrier sensing? (iii) implement collision detection? (iv) implement collision avoidance?
Answers: 3
question
Computers and Technology, 23.06.2019 23:00
Computer programming is one type of what career
Answers: 1
question
Computers and Technology, 24.06.2019 00:00
Which tool could be used to display only rows containing presidents who served two terms
Answers: 3
question
Computers and Technology, 25.06.2019 04:00
Use the wrap text icon to modify which graphic appears in the front of layered images modify the picture effects change the way text is wrapped around an object apply wordart to the text
Answers: 1
You know the right answer?
Circle all syntax errors and logic errors in following code, and correct it. there will be more than...
Questions
question
Mathematics, 25.05.2021 02:20
question
Mathematics, 25.05.2021 02:20
question
Mathematics, 25.05.2021 02:20
question
Mathematics, 25.05.2021 02:20
question
Mathematics, 25.05.2021 02:20
Questions on the website: 13722367