CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    Join Date
    May 2017
    Posts
    182

    Re: printing multiple figures side by side

    The problem is that instructors are so strict on material covered only . if I use something new from else where I will get a 0 because the problem said for loop and use Technics u learned in this chapter which are only simple for loop skills for beginners u see ?
    Last edited by david16; June 19th, 2017 at 04:22 PM.

  2. #17
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,825

    Re: printing multiple figures side by side

    So have you covered the ? ternary operator?

    You should be learning how to code the c++ way
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  3. #18
    Join Date
    May 2017
    Posts
    182

    Re: printing multiple figures side by side

    NO I didnt . I only covered few topic till now . And I will have to use them to solve this problem

  4. #19
    Join Date
    May 2017
    Posts
    182

    Re: printing multiple figures side by side

    hello there its me again . I did update my code a bit . remember I want the figure to be displayed side by side . I made 2 of them by actually replacing the other sides of the triangle which form a rectangle by spaces still having 2 can you help ?? this is my code

    Code:
     #include < iostream >
    using namespace std;
    
    int main ()
    {
      
    	for ( int i = 1 ; i <= 10 ; ++i ) {    
    
          for ( int j = 1 ; j <= 10 ; j++ ) {
              
    		  if ( j <= i ){
                
    			 cout << "*";
              }
    		  
    		  else {
                
    			 cout << " ";
              }
          }
    
          for ( int j = 1 ; j <= 10 ; j++ ) {
             
    		  if ( j >= i ) {
                
    			 cout << "*";
              }
    		  
    		  else {
                
    		 cout << " ";
              }
          }
    
          cout << endl;
    
    }
    	int k , l ;
       
       for (  k = 1 ; k <= 10 ; k++ ) {
    
    	   for ( l = k ; l < 10 ; l++ ) {
    
    			   cout << " ";
    	 
    	   }
    
    	       for ( l = 1 ; l <= k ; l++ ) {
    
    			   cout << "*";
    
    		   }
    	   
    	   cout << endl;
    
       }
      
    	 cout << "\n";
       
       int i , j;
      
       for (  i = 1 ; i <= 10 ; i++ ) {
    
    	   for ( j = 1 ; j < i ; j++ ) {
    
    			   cout << " ";
    	 
    	   }
    
    	      for ( j = i ; j <= 10 ; ++j ) {
       
    		        cout << "*";
    		}
    
    		 cout << endl;
    
       }
    	system ("pause");
       return 0;
    
    }
    thx for ur help

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured