Ok, I'm sure there has got to be newbies like me somewhere out there reading this. I'm going through the tutorials and I want to eventually be through all of them. I just finished the 4th one (functions-->cool, hehe). Here is what I have so far that uses stuff from the first 4 tutorials (except loops):
#include <iostream.h>
#include <conio.h>
#include <windows.h>
#include <stdlib.h>
int avg(int x, int y, int n);
int main()
{
cout<<"This program will get the average of numbers you enter."<<endl;
int x, y, n;
cout<<"Please enter the scores to be averaged (use a space in between numbers): ";
cin>>x>>y;
cout<<"Enter how many scores you entered: ";
cin>>n;
cout<<"The average of you numbers is: "<<avg(x, y, n)<<flush;
_getch();
return 0;
}
int avg(int x, int y, int n)
{
return (x+y)/n;
}
now you other newbies show me what you got too! And advanced people show us what we will be able to do eventually!



LinkBack URL
About LinkBacks


