Commit 921520c6 authored by Tobias Allrich's avatar Tobias Allrich
Browse files

Minor improvements and example for references

parent 6bc4403c
......@@ -18,7 +18,7 @@ int main()
cout<<"Bitte geben Sie ein Jahr ein: ";
cin>>i;
/*for(i; i > 0; i--)*/
for(i; i > 0; i--)
cout<<rehe(i)<<" Rehe im Jahr "<<i<<"\n";
return 0;
}
#include <iostream>
using namespace std;
int quer(int a, int &n)
{
n = 0;
int q = 0;
while(a != 0)
{
q += a % 10;
a /= 10;
n++;
}
return q;
}
int main()
{
int x = 5, t = 4;
//Die Referenz beanflussen die Variablen die der Funktion übergeben wurden
cout<<x<<" "<<quer(123,x)<<"\n";
cout<<t<<" "<<quer(321,t);
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment