Thread: newbie Q ..PLEASE HELP......

  1. #1
    Unregistered
    Guest

    Unhappy newbie Q ..PLEASE HELP......

    Hi,

    MERRY CHRISTMAS TO U!

    Self learner stuck on vc++ problem.

    Create a checkboard pattern with help of *s.8 rows 8 stars

    ********
    ********
    ********
    ********
    *********

    I dont know where to use cout<<" ";??????
    My code till now:

    #include<iostream.h>
    int main()
    {
    int counter,x;
    counter=0;

    while(counter<8)
    {
    for(x=0;x<8;x++)
    {
    cout<<"*";

    }
    cout<<endl;
    counter++;
    }
    return 0;
    }

    I have tried it putting in the inside loop ,outside the loop but invain...

    please HELP!!

    Thanks .

  2. #2
    Unregistered
    Guest

    Exclamation not up to the mark

    well,

    the pattern didnt come out as expected.
    2nd &4th line should be indented with one space.
    again trying to draw it ..

    ********
    ********
    ********
    ********
    ********

    Please hive me hint.....

    thankx

  3. #3
    Unregistered
    Guest

    Angry Once again

    Well, its not being indented.....I hope though u understand my query.Please reply.

  4. #4
    Registered User
    Join Date
    Nov 2001
    Posts
    17

    Lightbulb I think this is what you are after

    Give this code a go

    Code:
    #include<iostream.h> 
    
    int main() 
    { 
    	int counter,x;
    	counter=0; 
    
    	while(counter<8) 
    	{ 
    		if(counter%2)
    		{
    			for(x=0;x<8;x++) 
    			{ 
    				cout << "* "; 
    			}
    		}
    		else
    		{
    			for(x=0;x<8;x++) 
    			{ 
    				cout << " *"; 
    			}
    		}
    
    	cout<<endl;
    	counter++;
    
    	}
    
    	return 0; 
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. getting to grips with allegro and ms vc++ (newbie)
    By jimjamjahaa in forum C++ Programming
    Replies: 4
    Last Post: 11-18-2005, 07:49 PM
  2. Newbie in problem with looping
    By nrain in forum C Programming
    Replies: 6
    Last Post: 11-05-2005, 12:53 PM
  3. Newbie Programmer
    By Extropian in forum C++ Programming
    Replies: 3
    Last Post: 05-18-2004, 01:17 PM
  4. Some help for a newbie?
    By Ilmater in forum C++ Programming
    Replies: 23
    Last Post: 04-19-2004, 07:44 PM
  5. Newbie Game Develpoers Unite!
    By Telenosis in forum Game Programming
    Replies: 10
    Last Post: 06-22-2002, 02:02 PM