Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120752577
exercise01-3.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Jul 6, 19:10
Size
695 B
Mime Type
text/x-c
Expires
Tue, Jul 8, 19:10 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
27228917
Attached To
R1106 Programming Concept Rouaze
exercise01-3.cpp
View Options
/*
* exercise-template.cpp <--- The name of the source file goes here
*
* <--- Description of the program goes here.
*
* Created on: September 02, 2015 <--- Fill in the date here
* Author: Davide Forti <davide.forti@epfl.ch> <--- Fill in your name (and e-mail) here
*/
/*
* Any headers you need to include should be specified on the next lines
*/
#include <iostream>
#include <cmath>
int main(int argc, char* argv[])
{
double array1[3] = {5.0, 1.0, 2.0};
double array2[3] = {2.0, 8.0, 4.0};
double dotProduct;
for (int i=0; i<4; i++)
{
dotProduct += array1[i] * array2[i];
}
std::cout << "Scalar product result :" << dotProduct;
std::cout << " \n";
return 0;
}
Event Timeline
Log In to Comment