am new to C++

Feb 25, 2011 at 7:20pm
please i wanna write a programme console application using borland turbo c++
that ask users for an angle entered in radians,the programme should then display the sine,cos and tan library functions to determaine these values.)the output should be displayed in fixed points notation,rounded up to four decimal notation.
please any help.
Feb 25, 2011 at 7:29pm
I'm not sure how new you are but first thing you might want to do is #include some header files, then declare main, variables... etc
Feb 25, 2011 at 7:36pm
i know what you mean,ican do those,but i just want a brief explanation in full about it.
Feb 25, 2011 at 7:39pm
a brief explanation in full

That's a bit of an oxymoron.
You'll need to show us whatever you have so far.
Feb 25, 2011 at 7:46pm
i am really new to C++,but i know i use boreland turbo C++
i know the followings writing code for console application
bases on my understanding,you start like these:
#include <iostream>
using namespace std;
int main()
{

}.
but really i know a few things.
Feb 25, 2011 at 7:52pm
For the sin(), cos(), and tan() functions you need to #include<cmath>, and for fixed points notation you need to #include<iomanip>.
Feb 25, 2011 at 8:31pm
please can you explain further?
Feb 25, 2011 at 9:50pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//include your headers
#include <iostream>//lets you output to the console
#include <cmath>//provides basic math functions

//this function is where the program starts
int main(){
    double in;//double precision number (lets you use 3.14)
    cin>>in;//cin is defined in iostream
    //the >> operator is overloaded to input data from the console
    cout<<"Example";//cout outputs stuff to the console
    // anything surrounded with quotes is what's called a string
    return 0;}//return in main() ends the program
    //in any other function, it returns control to the function
    //that called it 

http://cplusplus.com/doc/tutorial/
Last edited on Feb 25, 2011 at 9:51pm
Feb 26, 2011 at 2:26am
Won't he need to #include<iomanip> as well?
Feb 26, 2011 at 2:20pm

#include <iostream>

int main()
{
int i;
std::cin>>i;
std::cout<<"i = "<<i<<std::endl;

return 0;
}

no need std:: if you use #include <iostream.h> head file .
Feb 26, 2011 at 2:21pm
or add using namespace std;
Feb 26, 2011 at 3:15pm
no need std:: if you use #include <iostream.h> head file .

That's because it's an old, deprecated header. Don't include it.
Topic archived. No new replies allowed.