Thread: errors

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

    Question errors

    hey guys can some body help me with this program coz when compile it theirs to many errors or can apply printf statement to it
    Code:
    #include<iostream>
    #iinclude<iomanip.h>
    #include<math.h>
    int main ()
    {
    double amount,
           principal=1000.0,
           rate=0.5
            
    
            cout<<"year"<<setw(21)
            <<"Amount on deposit""<<end1;
            for(int year<=10;year++){
                    amount=principal*pow(1.0+rate'year);
                    cout<<setw(4)<<year
                    <<setiosflags(ios::fixed/ios:showpoint)
                    <<setw(21)<<setprecission(2)
                    <<amount<<end1;
                    }
                    return 0;
                    }

  2. #2
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Location
    Banks of the River Styx
    Posts
    902
    1) You need a semi-colon at the end of your double declaration.

    2) Most of the cin/cout stuff is in std. use std::cout (for example), or do a using namespace std; outside & before your main() function.

    3) for() has three parts: for(initial_statement; test_condition; after_each_loop) -- you're missing the middle one.
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  3. #3
    Registered User
    Join Date
    May 2007
    Posts
    147
    start by adding a ; after the rate = 0.5

    see what happens.

  4. #4
    Registered User
    Join Date
    May 2009
    Posts
    23
    hey thanks mate i've found what was missing on the for loop .the middle part which is'year<=10'.

  5. #5
    Registered User
    Join Date
    May 2009
    Posts
    23
    looks like i have miss out many things in this program now i have to run it again.thanks for your help .

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Ten Errors
    By AverageSoftware in forum Contests Board
    Replies: 0
    Last Post: 07-20-2007, 10:50 AM
  2. Unknown Errors in simple program
    By neandrake in forum C++ Programming
    Replies: 16
    Last Post: 04-06-2004, 02:57 PM
  3. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM
  4. Help me with these errors... :-(
    By major_small in forum C++ Programming
    Replies: 6
    Last Post: 09-07-2003, 08:18 PM
  5. errors in class(urgent)
    By ayesha in forum C++ Programming
    Replies: 2
    Last Post: 11-10-2001, 06:51 PM