Tags:
create new tag
view all tags

Day 2 Sample code

Hello world

#include <iostream>
using namespace std;
int main()
{
  cout << "Hello, world." << endl;
return 0;
}

01-08.cpp

#include <iostream>
using namespace std;

int main( )
{
    int number_of_pods, peas_per_pod, total_peas;
    cout << "Press return after entering a number.\n";
    cout << "Enter the number of pods:\n";
    cin >> number_of_pods;
    cout << "Enter the number of peas in a pod:\n";
    cin >> peas_per_pod;

    total_peas = number_of_pods * peas_per_pod;
    //number_of_pods * peas_per_pod = total_peas;
    cout << "If you have ";
    cout << number_of_pods;
    cout << " pea pods\n";
    cout << "and ";
    cout << peas_per_pod;
    cout << " peas in each pod, then\n";
    cout << "you have ";
    cout << total_peas;
    cout << " peas in all the pods.\n";
    
    return 0;
}

08-10.cpp

#include <iostream> 
using namespace std;

int main( )
{
    cout << "Testing 1, 2, 3\n";
    return 0;
}
*
Topic attachments
I Attachment History Action Size Date Who Comment
PowerPointpptx Day2.pptx r1 manage 6082.5 K 2015-08-30 - 17:38 JimSkon Day2
Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2016-08-29 - JimSkon
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback