| | |
how to do something special with this question
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2004
Posts: 7
Reputation:
Solved Threads: 0
i have got to write a program to read a set of program n print out the average.
it will start by prompting the user for the number of numbers to be read and will then prompt for the individual numbers with a prompt such as Enter Number 23 to indicate to thr user which data item is currently being entered.now all that is easy but i have to do something special when prompting for the last number.here is what io have done but am unable to include the special thing for the last number have tried to put it in the loop an its displaying me 6 time the cout<<"enter the last number".i have written this program the way my lecturer has teach us.here is the program
// program to read set of number and print out their average
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,n,x,sum;
float average;
cout<<"Enter the number of numbers to be read"<<endl;
cin>>n;
sum=0;
for(i=1;i<=n;i++)
{
cout<<"Enter number"<<endl;
cin>>x;
sum=sum+x; }
average=sum/n;
cout<<"the average of the numbers is"<<average<<endl;
getch();
}
it will start by prompting the user for the number of numbers to be read and will then prompt for the individual numbers with a prompt such as Enter Number 23 to indicate to thr user which data item is currently being entered.now all that is easy but i have to do something special when prompting for the last number.here is what io have done but am unable to include the special thing for the last number have tried to put it in the loop an its displaying me 6 time the cout<<"enter the last number".i have written this program the way my lecturer has teach us.here is the program
// program to read set of number and print out their average
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,n,x,sum;
float average;
cout<<"Enter the number of numbers to be read"<<endl;
cin>>n;
sum=0;
for(i=1;i<=n;i++)
{
cout<<"Enter number"<<endl;
cin>>x;
sum=sum+x; }
average=sum/n;
cout<<"the average of the numbers is"<<average<<endl;
getch();
}
•
•
Join Date: Oct 2004
Posts: 15
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by Narue
>i have written this program the way my lecturer has teach us.
You have my sympathy, your lecturer is a moron and clearly doesn't know enough to be teaching.
I have to agree the romanian girl has spelling problems with the english language, but I had to order my sausage and egg Burger King breakfast three times before the lady knew what I was talking about, this morning and that was in euston london..
also I am shit at english and do not believe it is a core part of writing application code, as most of the books I have read were reference guides. apart from "the story of O" of course....
stay safe....
![]() |
Similar Threads
- for loop (C++)
- News Story: Computers, Other Manufacturers Looking Great in '08? (Upcoming News Stories)
- Dumb Question (HTML and CSS)
- Question about monitoring or logging in Windows 2k server (Windows NT / 2000 / XP)
Other Threads in the C++ Forum
- Previous Thread: Establishing A connection between Three programs.
- Next Thread: compiler
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion count data database delete deploy desktop developer directshow dll dynamiccharacterarray email encryption error file forms fstream function functions game getline google graph homeworkhelp homeworkhelper iamthwee ifstream input int integer lib linkedlist linux list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates text tree unix url vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






