// Lab 8, Working with structs
// Programmer : Maiar Khattab
// Editor(s) used : Code Blocks 13.12
// Compiler(s) used : Code Blocks 13.12
#include<iostream>
using std::cout;
using std::endl;
#include<cstdlib>
//struct def
struct tod
{
int hour;// the hr , 0-23
int minute;// the min, 0-59
int second;//the sec, 0-59
char descr [32];//the description of the time of day
};
//void printTod(const tod&);
int main ()
{
cout << "Lab 8, Working With structs\n";
cout << "Programmer: Maiar Khattab\n";
cout << "Editor(s) used: Code Blocks 13.12\n";
cout << "Compiler(s) used: Code Blocks 13.12\n";
cout << "File: " << __FILE__ << endl;
cout << "Complied: " << __DATE__ << " at " << __TIME__ << endl << endl;
tod theTime[] = {{12,0,0, "noon"},
{0,0,0," midnight"},
{6,00,00," supper "},
{11,30,0,"bedtime"}};
for(int i; i <5; i++)
{
char descr [32];
cout << theTime[i].descr << " is " << theTime[i].hour << ':'
<< theTime[i].minute << ":" << theTime[i].second << endl;
}
}
IC8vIExhYiA4LCBXb3JraW5nIHdpdGggc3RydWN0cwovLyBQcm9ncmFtbWVyIDogTWFpYXIgS2hhdHRhYgovLyBFZGl0b3IocykgdXNlZCA6IENvZGUgQmxvY2tzIDEzLjEyCi8vIENvbXBpbGVyKHMpIHVzZWQgOiBDb2RlIEJsb2NrcyAxMy4xMgoKI2luY2x1ZGU8aW9zdHJlYW0+CnVzaW5nIHN0ZDo6Y291dDsKdXNpbmcgc3RkOjplbmRsOwoKI2luY2x1ZGU8Y3N0ZGxpYj4KCi8vc3RydWN0IGRlZgpzdHJ1Y3QgdG9kCnsKaW50IGhvdXI7Ly8gdGhlIGhyICwgMC0yMwppbnQgbWludXRlOy8vIHRoZSBtaW4sIDAtNTkKaW50IHNlY29uZDsvL3RoZSBzZWMsIDAtNTkKY2hhciBkZXNjciBbMzJdOy8vdGhlIGRlc2NyaXB0aW9uIG9mIHRoZSB0aW1lIG9mIGRheQoKfTsKLy92b2lkIHByaW50VG9kKGNvbnN0IHRvZCYpOwppbnQgbWFpbiAoKQp7CiAgY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OwpvZnN0cmVhbSBvdXQoJnF1b3Q7bWF4bWF0Lm91dCZxdW90Oyk7CgppbnQgbWFpbigpCnsKICAgIGxvbmcgaW50IGFbMTAxXVsxMDFdLCBuLCBtLCBpLCBqOwogICAgaW4mZ3Q7Jmd0O24mZ3Q7Jmd0O207CiAgICBmb3IoaT0wOyBpJmx0O247IGkrKykKICAgICAgICBmb3Ioaj0wOyBqJmx0O207IGorKykKICAgICAgICAgICAgaW4mZ3Q7Jmd0O2FbaV1bal07CiAgICBmb3IoaT0wOyBpJmx0O247IGkrKykKICAgIHsKICAgICAgICBpbnQgbWF4ID0gYVtpXVswXTsKICAgICAgICBmb3Ioaj0xOyBqJmx0O207IGorKykKICAgICAgICAgICAgaWYoYVtpXVtqXSZndDttYXgpCiAgICAgICAgICAgICAgICBtYXggPSBhW2ldW2pdOwogICAgICAgIGZvcihqPTA7IGombHQ7bTsgaisrKQogICAgICAgICAgICBpZihhW2ldW2pdPT1tYXgpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIG91dCZsdDsmbHQ7bWF4Jmx0OyZsdDsmcXVvdDsgJnF1b3Q7Jmx0OyZsdDtqKzEmbHQ7Jmx0O2VuZGw7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgfQp9
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("maxmat.in");
ofstream out("maxmat.out");
int main()
{
long int a[101][101], n, m, i, j;
in>>n>>m;
for(i=0; i<n; i++)
for(j=0; j<m; j++)
in>>a[i][j];
for(i=0; i<n; i++)
{
int max = a[i][0];
for(j=1; j<m; j++)
if(a[i][j]>max)
max = a[i][j];
for(j=0; j<m; j++)
if(a[i][j]==max)
{
out<<max<<" "<<j+1<<endl;
break;
}
}
}