Click here to Skip to main content
15,881,687 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX

What I have tried:

for (int row = 1; row <= 10; row++){

for (int column = 1; column <= 10; column++) {

if(column 1=10){
System.out.print( "x");
}//end if else

}//end column
}//end row
Posted
Updated 26-Nov-18 21:02pm
Comments
Mohibur Rashid 26-Nov-18 23:30pm    
Your code won't even compile in any compiler that you have mentioned above.
What's your actual compiler? Both C++ and Java cannot be your target
Member 14068201 26-Nov-18 23:34pm    
I use netbeans, Netbeans does not use standard javac
Mohibur Rashid 26-Nov-18 23:54pm    
So, what non-standard java are you using and if it is not standard java then why tagging java or even c++?

I am asking this question to help you, not to judge you.

You really don't need if statements:
Java
public static void main(String arg[])
 {
   for (int r = 0; r < 10; ++r)
   {
     for (int c = 0; c < 10; ++c)
       System.out.print('X');
     System.out.println();
   }
 }
 
Share this answer
 
Your code do not behave the way you expect, or you don't understand why !

There is an almost universal solution: Run your code on debugger step by step, inspect variables.
The debugger is here to show you what your code is doing and your task is to compare with what it should do.
There is no magic in the debugger, it don't know what your code is supposed to do, it don't find bugs, it just help you to by showing you what is going on. When the code don't do what is expected, you are close to a bug.
To see what your code is doing: Just set a breakpoint and see your code performing, the debugger allow you to execute lines 1 by 1 and to inspect variables as it execute.

Debugger - Wikipedia, the free encyclopedia[^]

Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[^]
Basic Debugging with Visual Studio 2010 - YouTube[^]

Debugging C# Code in Visual Studio - YouTube[^]

The debugger is here to only show you what your code is doing and your task is to compare with what it should do.
 
Share this answer
 
You must code
C++
System.out.print("x");

if(column == 10){
  System.out.print("\n");//print newline
What about learn to code and debug?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900