Results 1 to 2 of 2
Like Tree1Likes
  • 1 Post By KevinWorkman

Thread: how to convert from "cout" to println

  1. #1
    abdul9383 is offline Member
    Join Date
    Nov 2011
    Posts
    4
    Rep Power
    0

    Default how to convert from "cout" to println

    The program im using doesn't accept cout so how would i fix this code
    public class Lab1000

    public static void main(String[]) {

    #include<iostream>
    using namespace std;
    int F(int x)
    {
    return (x*x-16);
    }
    int main()
    {
    cout << " x" << " << "F(x)" << endl;
    for(int i=1; i<=10; i++)
    cout << x <<" "<< F(x) << endl;
    return 0;
    }

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,691
    Rep Power
    8

    Default Re: how to convert from "cout" to println

    You can't just copy code from one language into another. Translate the original code into English, then translate that English into an algorithm in Java.
    DarrylBurke likes this.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. System.out.println("Hello Java-Forums!");
    By Arsenic in forum Introductions
    Replies: 0
    Last Post: 03-05-2009, 05:39 PM
  2. Replies: 2
    Last Post: 01-24-2009, 06:56 PM
  3. Replies: 1
    Last Post: 10-20-2008, 07:35 AM
  4. Replies: 11
    Last Post: 08-19-2008, 11:29 AM

Posting Permissions

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