TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Carlos Robles Calderon
NA
8
2.1k
How to multiply N number for each number in a Linked list?
Mar 6 2015 5:37 PM
Well, i'm a total noob in this of codding and programming so sorry if i say something stupid or without logic at all... Wel the problem is that i have a algorithm or a program that i have to do (University Homework), and i dont get how to do it.. This is what i have:
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <list>
using namespace std;
int main(int argc, char *argv[]) {
list<double> lalista;
double num, suma=0;
cout << "A Simple calc:" << endl;
do {
cout << "Insert a numbrer, or 0 to exit: ";
cin >> num;
if (num !=0) lalista.push_back(num);
}
while (num !=0);
cout << "-----------" << endl;
while( !lalista.empty() )
{
num = lalista.front();
cout << setw(10) << num << endl;
suma += num;
lalista.pop_front();
}
cout << "----------" << endl;
cout << setw(10) << suma << endl;
system ("PAUSE");
return EXIT_SUCCESS;
}
in this one is adding the whole thing, and i dont get how to put it to multiply each of the number stored in the linked list, could help me? Thanks (i'm working in c++ sorry, if i disrupt you).
Reply
Answers (
3
)
login failed for user error
Dynamic GridView Event