ExclamationA little help? C++

Posts 1–8 of 8 · Page 1 of 1
A little help? C++
::WARNING:: LOTS OF WRITING BELOW.
@~FALLEN~ @giniyat101 @Skrillex @tryhacker @BACKD00R @CFhackerfree @BarleyCandy @pceumel @Exsilium @Lebaa @skiddy2

I finally gathered my thoughts and told my dad that I wanted to learn some C++. He said there are many types of "programming", like java, science, and etc. But, he just explained to me in detail today that will get me started on C++, and make me kind of realize things.
My dad gave me a project for me to start. I need to make a simple program, he doesn't care about looks, that if I type in a degree (temperature), and when I click a button, it will convert to fahrenheit.
My dad's at work and will NOT be coming back until tomorrow afternoon, so I will ask.

1. What is the difference between "sub" and "function"?

2. What is the difference between "Sub Process" and "SubRoutine"?

3. What exactly IS iostream? Like #include <iostream>?

4. What is #include <iosys.h> and what does that do?

5. If I type "#include <math.h>, would the program be able to do ANY type of math? Like roots, sin cos tan, anything?

6. For variable inputs, is this right or wrong?

int = ONLY POSITIVE numerics. (fahrenheit)
float= BOTH negative AND positive. (degree)
float degree=0; (im trying to make float value (degree) nothing. Meaning, no value for degree is set as of now.)
int farenheit=0; (im trying to make float value (degree) nothing. Meaning, no value for degree is set as of now.)

7. What does "int main ()" do if the first statement in question 6 is right?
Since I'm learning C++ as well, all I know is <iostream> is known as a header. It is used for input and output. The i in <iostream> means input, while the o means output.

#include Tells your program the header you are using.

So if you do #include <iostream> - You're basically telling your program that you are using the input and output stream in your program.
Quote Originally Posted by Hero View Post
Since I'm learning C++ as well, all I know is <iostream> is known as a header. It is used for input and output. The i in <iostream> means input, while the o means output.

#include Tells your program the header you are using.

So if you do #include <iostream> - You're basically telling your program that you are using the input and output stream in your program.
oh okay so I NEED the #include <iostream> command for my project right? Because for input I'm using degree, and output for fahrenheit?
okay this is the wrong section and iam pretty sure

1- both sub and function keywords are not defined in c++ they are probably from vb
sub doesnt return a value (aka void) while function does

2- i dont know really, maybe u tell me where u got this 2 words?

3- iostream is a header files contains some functions (and subs before you say it ) which deals with the console input and output like cout and cin etc

4- never heared about it sorry but its another header file ofc

5- yes you may access alot of math functions there like square root , power , trigonometric functions etc

6- int : signed 4 bytes integer, can be positive or negative

7- float: singned 4 bytes number, can have decimal points, can be positive or negative

8-int main():

defines the first controlable code by the programmer, but your program routine here

example (conversation between fahrenheit and celsius):

Code:
#include <iostream> //so we can use the console functions cout and cin
using namespace std; //now u dont need to use std::cout or std::cin

int main()
{
    float tempf, tempc; //variables to keep the temperatures.. i picked float because temperaturs can be negative, and can have decimal points ofc
    cout << "enter fahrenheit temperature"; //output the message you see
    cin >> tempf; //get fahrenheit from user input
    //not sure about the converting i have almost forgot everything about last year's physics xD
    tempc = (tempf-32)/1.8; //calculate celsius value
    cout << "the temperature in celsius equals " << tempc << endl; //output the result and ends the line
    return 0;//return to windows
}
you may put in your compiler and press ctrl+f5 yourself
Quote Originally Posted by giniyat101 View Post
okay this is the wrong section and iam pretty sure

1- both sub and function keywords are not defined in c++ they are probably from vb
sub doesnt return a value (aka void) while function does

2- i dont know really, maybe u tell me where u got this 2 words?

3- iostream is a header files contains some functions (and subs before you say it ) which deals with the console input and output like cout and cin etc

4- never heared about it sorry but its another header file ofc

5- yes you may access alot of math functions there like square root , power , trigonometric functions etc

6- int : signed 4 bytes integer, can be positive or negative

7- float: singned 4 bytes number, can have decimal points, can be positive or negative

8-int main():

defines the first controlable code by the programmer, but your program routine here

example (conversation between fahrenheit and celsius):

Code:
#include <iostream> //so we can use the console functions cout and cin
using namespace std; //now u dont need to use std::cout or std::cin

int main()
{
    float tempf, tempc; //variables to keep the temperatures.. i picked float because temperaturs can be negative, and can have decimal points ofc
    cout << "enter fahrenheit temperature"; //output the message you see
    cin >> tempf; //get fahrenheit from user input
    //not sure about the converting i have almost forgot everything about last year's physics xD
    tempc = (tempf-32)/1.8; //calculate celsius value
    cout << "the temperature in celsius equals " << tempc << endl; //output the result and ends the line
    return 0;//return to windows
}
you may put in your compiler and press ctrl+f5 yourself
hmm...my dad wrote out to me a completely different coding.
Quote Originally Posted by JimTheGreat View Post

hmm...my dad wrote out to me a completely different coding.
whatever, thats an easy example nothing else..
Quote Originally Posted by giniyat101 View Post
whatever, thats an easy example nothing else..
Alright I'll try this in my coding, and I'll open another thread if really needed.
/req close @Hero, as of now.
Thanks @giniyat101
Closed Upon Request.
Posts 1–8 of 8 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us