Help! int,cin,cout, and %!!

Can someone explain what int,cin,cout, and % briefly!? NO THE TUTORIAL doesn't help.... :D
1
2
3
4
5
6
7
8
9
10
11
12
#include<iostream>

using namespace std;

int main()
{
    int x = 0;
    cin >> x;
    cout<<x<<endl;
    
    return 1;
}
Int is short for integer; if you have been to middle school you know what an integer is. If you forgot, it's any whole number, positive or negative. It is a form of variable, capable of holding integers. Cin is the standard way of getting input from the user. Of course, the input must go somewhere, so you need to set up a variable of type string or char. Cout is the standard output function. %, I believe is the modulo operator, or something like that. All I know is that it is an operator that gives the remainder of 2 numbers, ex. 5%2 would return the value 1 because the remainder of 5/2 is 1. Also, // is a comment.Here is a little program to give a sample of what these are:
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
using namespace std;
int main()
{
cout << "Enter 2 numbers, and I'll give you their remainder\n"; // this is cout in action. This will print the prompt to the screen, along with a new line.
int a, b; // this is a variable which cin will store it's input inside of.
cin >> a >> b; // this is where the user enters his 2 numbers.
double c; // this is where the remainder will be stored.
c=a%b; // this is the modulo in action.
cout << a << "/" << b << " has a remainder of  " << c; // this outputs the 
// remainder. 
return 0;
}
Topic archived. No new replies allowed.