Completely incompetent c++'er, needing your help!!

This is a discussion on Completely incompetent c++'er, needing your help!! within the C++ Programming forums, part of the General Programming Boards category; i'm a beginner at c++ so be gentle lol I'm trying to make some sort of xy plotting graph as ...

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    3

    Completely incompetent c++'er, needing your help!!

    i'm a beginner at c++ so be gentle lol
    I'm trying to make some sort of xy plotting graph as dots as the xy plane.
    this is what i've gotten

    Code:
    const int ROWS = 21;
        const int COLS = 75;
    			
        char plot[ROWS][COLS];     // 21 by 75 
        
    	for (int x = 0; x < ROWS; x++)
    		for (int y = 0 ; y< COLS; y++)
    	{
    		plot[ROWS][COLS] = '.';
    	}
    But the thing is.. the graph is meant to look like this


    ..............................................
    ..............................................
    ..............................................
    ..............................................
    ..............................................


    But all i get once i compile it is.. something along the lines of


    ..............................................
    ..............................................
    ..............................................
    ..............................................
    .............................. <----- half unfinished graph

    if this sounds too vague mention it, no flaming pls, i'll try and fix it up
    Last edited by andyunderpants; 05-02-2009 at 09:45 PM.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You need to be printing a newline marker at the end of each row.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    >> plot[ROWS][COLS] = '.';

    Hint: what happened to x and y?
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  4. #4
    Registered User
    Join Date
    May 2009
    Posts
    3
    Quote Originally Posted by Sebastiani View Post
    >> plot[ROWS][COLS] = '.';

    Hint: what happened to x and y?
    i don't get it

  5. #5
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    As in "shouldn't you be using x and y as as indexes?".
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  6. #6
    Registered User
    Join Date
    May 2009
    Posts
    3
    nvm

    quzah's suggest helped.
    Last edited by andyunderpants; 05-02-2009 at 09:45 PM.

  7. #7
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,183
    And the answer to your next question is
    As in "shouldn't you be using x and y as as indexes?".

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Serial port: How to know when data has been completely sent
    By arjunajay in forum Windows Programming
    Replies: 8
    Last Post: 03-25-2009, 08:18 AM
  2. Problem with deleting completely blank lines
    By dnguyen1022 in forum C Programming
    Replies: 3
    Last Post: 12-07-2008, 10:51 AM
  3. Driver Problem
    By todd14 in forum C Programming
    Replies: 3
    Last Post: 04-04-2007, 11:46 PM
  4. Completely modular motherboards?
    By SMurf in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 02-23-2003, 11:56 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21