Hi! To Everyone! Could you tell me how I can use GCC with that file comunicatoin, because : g++ main.cpp program1.cpp -o program1.exe - not valid - It didn't saw program1.h and all declaration in him.
I had the task : Write a program that prints the numbers from 1 to 100. But for multiples of three print “Global” instead of the number and for the multiples of five print “Logic”. For numbers which are multiples of both three and five print “GlobalLogic"
//program1.h
#ifndef PROGRAM1_H
#define PROGRAM1_H 1
#include <iostream>
#define HUNDREDPLUS1 101
#define BEGIN1 1
#define K3 3
#define K5 5
using std::cout;
using std::endl;
void Multiples_3_5();
#endif //PROGRAM1_H
//main.cpp
#include"program1.h"
int main (int argc, const char * argv )
{
Multiples_3_5();
return 0;
}// main
//program.cpp
/**
* @file program1.cpp
* @brief A source file for program1
*
*
* Copyright 2014 by Nikolas9896,
*
* This software is the confidential and proprietary information
* of Nikolas9896 ("Confidential Information"). You
* shall not disclose such Confidential Information and shall use
* it only in accordance with the terms of the license agreement
* you entered into with Nikolas9896.
**/
void Multiples_3_5( )
{
unsigned short it = BEGIN1;
while( it < HUNDREDPLUS1 )
{
if( ( !( it % K3 ) && !( it % K5 ) ) )
{
cout << "GlobalLogic"<< it << endl;
}
else if( !( it % K3 ) )
{
cout << "Global" << it << endl;
}
else if( !( it % K5 ) )
{
cout << "Logic" << it << endl;
}
else
{
cout << it << endl;
}
++it;
}
}