Answer to Question #28103 in C++ for Merlin Priyanga

Question #28103
When i compiled my c++ program it was telling "Declaration terminated incorrectly"
Also "Statement missing"
What are these?
Kindly tell the answer....
1
Expert's answer
2013-04-11T04:30:21-0400
for example if you have such code:
void baklanges(list<MataIn> lista);{int n = text.length();for(int i =0; i < n/2; i++){char temp = text.at(i); text.at(i)= text.at(n-1-i); text.at(n-1-i)= temp;} cout<<"Texten baklanges:\n"<<text<<endl;}

Declaration terminated& incorrectly
Remove this semicolon.

void baklanges(list<MataIn> lista);

so this mistake means that something is wrong with syntax.


Statement missing -
In this example, a goto statement transfers control to the point labeled stop when i equals 3.

& // goto_statement.cpp #include <stdio.h> int main() { int i, j; for ( i = 0; i < 10; i++ ) { printf_s( "Outer loop executing. i = %d\n", i ); for ( j = 0; j < 2; j++ ) { printf_s( " Inner loop executing. j = %d\n", j ); if ( i == 3 ) goto stop; } } // This message does not print: printf_s( "Loop exited. i = %d\n", i ); stop: printf_s( "Jumped to stop. i = %d\n", i ); }
one more example
The following example illustrates the usage of the break statement in a for loop.

&
&
// break_statement.cpp

#include <stdio.h>

int main()
{
int i;

for (i = 1; i < 10; i++)
{
& printf_s("%d\n", i);

& if (i == 4)
break;
}
}& // Loop exits after printing 1 through 4

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Assignment Expert
29.04.13, 14:16

You're welcome. We are glad to be helpful. If you really liked our service please press like-button beside answer field. Thank you!

Merlin Priyanga
28.04.13, 23:25

Thank you so much

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS