Professional Documents
Culture Documents
BC190408018
BC190408018
Question: (20)
Note:
1. Include <iostream >, <windows.h>, and < tchar.h> header files in your
program.
2. Focus only what has been asked in the assignment. Marks will be deducted
on including extra or irrelevant code.
3. Question requires a complete program.
4. After the main code, you should place the code of “PrintText.cpp”. The
sample pattern of your assignment solution should be as:
Main code:
#include <iostream>
#include <windows.h>
#include <tchar.h>
int main() {
_TCHAR szPath[] = _T("C:\\Users\\Public\\Documents\\PrintText.exe");
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si); // Corrected typo: si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
else {
std::cout << "Error Code: " << GetLastError() << std::endl;
}
return 0;
}//main code ended
PrintText code:
#include <iostream>
int main(){
for(int i = 0; i<5; i++){
std::cout <<"NAME: RAHMEEN SHAHBAZ" << std::endl;
std::cout <<"Roll Number: BC190408018" << std::endl;
}
} //End
5. Your solution should be a single Microsoft Word file (doc or docx). File in
any other format will be awarded zero marks.