GRP Assignmnet Modifed #1

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

MIDLANDS STATE UNIVERCITY

ZVISHAVANE CAMPUS

FACULTY OF ENGINEERING AND GEOSCIENCES


DEPARTMENT OF MINING ENGINEERING

MODULE : HMINE 128


LECTURER : Dr GUMBO
COMPUTER GROUP ASSIGNMENT

GROUP MEMBERS
DENNIS MISASE R2116778G Metallurgical Engineering
MOREBLESSING MUSHAYABASA R2114048P Metallurgical Engineering
RUTENDO MATARA R2210834R Metallurgical Engineering
QUESTION 1

Write a C++ program to enter a string then display the message boxes "Greater than 6
characters", "Less than 6 characters", and "Equal to 6 characters" if this number was greater,
less, and equal to six characters respectively.

#include<iostream>

#include<conio.h>

#include<stdio.h>

#include<windows.h>

using namespace std;

int main()

char str[50];

int i,Char;

Char=0;

cout<<"Please enter the string for count characters\n";

gets(str);

for(i=0; str[i] != '\0'; i++){

if(str[i]!=' ')

Char++;

if(Char<6)
{

MessageBox(NULL, "Less than 6 characters", "Message


Box!",MB_ICONINFORMATION|MB_OK);}

else if(Char>6)

MessageBox(NULL, "Greater than 6 characters", "Message


Box!",MB_ICONINFORMATION|MB_OK);}

else if(Char=6)

MessageBox(NULL, "Equal to 6 characters", "Message


Box!",MB_ICONINFORMATION|MB_OK);}

else

getch();

return 0;

QUESTION 2

Write a C++ program to enter a number represents a person age then display the following on
a message boxes:

#include <iostream>
#include <windows.h>
using namespace std;

int main()
{
int age;
cout<< "Enter your age:";
cin>> age;

if (age <=0)
{
MessageBox(NULL, "Wrong Age", "Age Message", MB_OK);
}
else if (age < 8)
{
MessageBox(NULL, "Child", "Age Message", MB_OK);
}
else if (age>=8 && age < 18)
{
MessageBox(NULL, "Boy", "Age Message", MB_OK);
}
else if (age >=18 && age < 35)
{
MessageBox(NULL, "Young", "Age Message", MB_OK);
}
else if (age >=35 && age < 65)
{
MessageBox(NULL, "Old", "Age Message", MB_OK);
}
else
{
MessageBox(NULL, "Very OLd", "Age Message", MB_OK);
}

return 0;
}

QUESTION 3
Write C++ program to make countdown loop using goto statement.

#include <iostream>

#include <windows.h>

using namespace std;

int main()

int count = 10;

loop:

cout<< count << endl;

count--;

if(count >-0)

{
Sleep(200);

goto loop;

cout<< " FIRE!" << endl;

return 0;

You might also like