calculating square of some numbers

This is a discussion on calculating square of some numbers within the C++ Programming forums, part of the General Programming Boards category; Maybe you should use a tab in-between? Code: cout << left << setw(10) << teller << right << '\t' cout ...

  1. #16
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,594
    Maybe you should use a tab in-between?
    Code:
    cout << left << setw(10) << teller << right << '\t'
    cout << setw(10) << setprecision(3) << uitkomst
    cout << setprecision(prec) << endl ;
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  2. #17
    Registered User
    Join Date
    May 2010
    Posts
    230
    Hello Elysia,

    Sorry but it don't work.

    Roelof

  3. #18
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,594
    Then how do you want it to look and how is it different from your current code?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #19
    Registered User
    Join Date
    May 2010
    Posts
    230
    Hello,

    What I see now is : 11122233334444 and so on.
    What I want see is :

    1 1
    2 1
    ,,,
    25 5

    So i 2 collum idea.

    Roelof

  5. #20
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,594
    The code I posted:
    Code:
    #include <iostream>
    #include <vector>
    #include <iomanip>
    
    using namespace std;
    
    int main()
    {
    	int teller = 0, uitkomst = 0;
    	cout << left << setw(10) << teller << right << '\t';
    	cout << setw(10) << setprecision(3) << uitkomst;
    	cout << endl ;
    }
    Produces
    0 0
    ...for me. How is that different from what you want?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #21
    Registered User
    Join Date
    May 2010
    Posts
    230
    Wierd,

    This is working and I do the same on mine main.cpp and the output is different.

    Roelof

  7. #22
    Registered User
    Join Date
    Feb 2009
    Posts
    329
    Quote Originally Posted by roelof View Post
    Wierd,

    This is working and I do the same on mine main.cpp and the output is different.

    Roelof
    Are you making sure that << endl is within your for loop as in your earlier example it wasn't.

  8. #23
    Registered User
    Join Date
    May 2010
    Posts
    230
    Wierd,

    I tried to do step by step using the source of Elysia and now everythings works fine.
    And I see no difference between the source then and now.

    Roelof

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 12-23-2009, 12:55 PM
  2. Tic Tac Toe Comp Move help
    By swgh in forum C++ Programming
    Replies: 5
    Last Post: 09-24-2008, 11:05 AM
  3. Calculating Square Root?
    By Neo1 in forum C++ Programming
    Replies: 5
    Last Post: 05-25-2007, 02:40 AM
  4. Loop seg error
    By Zishaan in forum Game Programming
    Replies: 2
    Last Post: 03-28-2007, 01:27 PM
  5. A (complex) question on numbers
    By Unregistered in forum C++ Programming
    Replies: 8
    Last Post: 02-03-2002, 05:38 PM

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