Working on END key...but having lot of trouble with coding...but still trying to complete it as soon as possible....
Wednesday, 30 January 2013
Sunday, 27 January 2013
OOP344 Week 3 to do
I tried a lot to make it in another way. But it is only done by this way..
X-mover:
case RIGHT:
if(col == console.getCols()-2 && row == console.getRows()-1){
console.alarm();
}
else if(col < console.getCols()-1){
col++;
}
break;
case DOWN:
if(row == console.getRows()-2 && col == console.getCols()-1) {
console.alarm();
}
else if(row < console.getRows()-1){
row++;
}
break;
Removing if else statement from console.display() function.. It is done by condition operator
void Console::display(const char* str, int row, int col, int fieldLen){
setPos(row, col);
int i;
int lenght;
lenght = strlen(str);
for(i=0,fieldLen==0?fieldLen=lenght:i=0;i<fieldLen;str[i]!=0?putChar(str[i]):putChar(' '),i++);
}
X-mover:
case RIGHT:
if(col == console.getCols()-2 && row == console.getRows()-1){
console.alarm();
}
else if(col < console.getCols()-1){
col++;
}
break;
case DOWN:
if(row == console.getRows()-2 && col == console.getCols()-1) {
console.alarm();
}
else if(row < console.getRows()-1){
row++;
}
break;
Removing if else statement from console.display() function.. It is done by condition operator
void Console::display(const char* str, int row, int col, int fieldLen){
setPos(row, col);
int i;
int lenght;
lenght = strlen(str);
for(i=0,fieldLen==0?fieldLen=lenght:i=0;i<fieldLen;str[i]!=0?putChar(str[i]):putChar(' '),i++);
}
Saturday, 26 January 2013
Friday, 25 January 2013
Project 0.1
It is really challenging for me because I do not have any previous experience.....
trying hard to finish it as soon as possible...but overall it is very interesting to do.... :)
trying hard to finish it as soon as possible...but overall it is very interesting to do.... :)
Monday, 21 January 2013
OOP344 week 2 Exercises
1. Sum of two numbers by command line
#include<iostream>
#include<stdlib.h>
using namespace std;
int main(int argc, char* argv[])
{
int sum;
if(argc == 3)
{
cout << "Sum of the number is: "<< atoi(argv[1]) + atoi(argv[2]) << endl;
}
else
{
cout << "Please enter thr correct input" << endl;
}
return 0;
}
2. Subtraction of two numbers by command line
#include<iostream>
#include<stdlib.h>
using namespace std;
int main(int argc, char* argv[])
{
int sum;
if(argc == 3)
{
cout << "Sum of the number is: "<< atoi(argv[1]) - atoi(argv[2]) << endl;
}
else
{
cout << "Please enter thr correct input" << endl;
}
return 0;
}
3. Multipication of two numbers by command line
#include<iostream>
#include<stdlib.h>
using namespace std;
int main(int argc, char* argv[])
{
int sum;
if(argc == 3)
{
cout << "Sum of the number is: "<< atoi(argv[1]) * atoi(argv[2]) << endl;
}
else
{
cout << "Please enter thr correct input" << endl;
}
return 0;
}
#include<stdlib.h>
using namespace std;
int main(int argc, char* argv[])
{
int sum;
if(argc == 3)
{
cout << "Sum of the number is: "<< atoi(argv[1]) * atoi(argv[2]) << endl;
}
else
{
cout << "Please enter thr correct input" << endl;
}
return 0;
}
4. Division of two numbers by command line
#include<iostream>
#include<stdlib.h>
using namespace std;
int main(int argc, char* argv[])
{
int sum;
if(argc == 3)
{
cout << "Sum of the number is: "<< atoi(argv[1]) / atoi(argv[2]) << endl;
}
else
{
cout << "Please enter thr correct input" << endl;
}
return 0;
}
#include<stdlib.h>
using namespace std;
int main(int argc, char* argv[])
{
int sum;
if(argc == 3)
{
cout << "Sum of the number is: "<< atoi(argv[1]) / atoi(argv[2]) << endl;
}
else
{
cout << "Please enter thr correct input" << endl;
}
return 0;
}
Wednesday, 9 January 2013
First day in OOP344 class....
Hi everyone
I want to share my experience of programming in Seneca College. Please give me comments and any relevant information related to OOP344.
Thanks
Pankaj Sama
I want to share my experience of programming in Seneca College. Please give me comments and any relevant information related to OOP344.
Thanks
Pankaj Sama
Subscribe to:
Posts (Atom)