Cannot Debug this Code

#include <iostream.h>
#include <string.h>
int main()
{
char partno[15];
int length;
cout << "\nEnter the part number: ";
cin >> partno;
length = strlen(partno);
if(length == 4 || length == 5)
{
if((partno[1] == 'M' || partno[1] == 'm') && (partno[2] == 'S' || partno[2] == 's'))
cout << "\nDelivery Method is : Mail - Standard. ";
else if((partno[1] == 'M' || partno[1] == 'm') && (partno[2] == 'P' || partno[2] == 'p'))
cout << "\nDelivery Method is : Mail - Priority. ";
else if((partno[1] == 'F' || partno[1] == 'f') && (partno[2] == 'S' || partno[2] == 's'))
cout << "\nDelivery Method is : FedEx- Standard. ";
else if((partno[1] == 'F' || partno[1] == 'f') && (partno[2] == 'O' || partno[2] == 'o'))
cout << "\nDelivery Method is : FedEx - Overnight. ";
else if((partno[1] == 'U' || partno[1] == 'u') && (partno[2] == 'P' || partno[2] == 'p'))
cout << "\nDelivery Method is : UPS. ";
else
cout << "\nDelivery Method should be one of MS, Mp, FS, FO or UP";
}
else
cout << "\nLength of the partnumber should be 4 or 5 characters.";
return 0;
}


3 IntelliSense: identifier "cout" is undefined c:\Cpp8\Chap 13\Intermediate26 Project\Intermediate26 Project\Intermediate26.cpp 7 2 Intermediate26 Project

4 IntelliSense: identifier "cin" is undefined c:\Cpp8\Chap 13\Intermediate26 Project\Intermediate26 Project\Intermediate26.cpp 8 2 Intermediate26 Project

2 IntelliSense: cannot open source file "iostream.h" c:\Cpp8\Chap 13\Intermediate26 Project\Intermediate26 Project\Intermediate26.cpp 1 1 Intermediate26 Project

Error 1 error C1083: Cannot open include file: 'iostream.h': No such file or directory c:\cpp8\chap 13\intermediate26 project\intermediate26 project\intermediate26.cpp 1 1 Intermediate26 Project

Last edited on
Use this code to compile.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#include <string.h>

using namespace std;

int main()
{
char partno[15];
int length;
cout << "\nEnter the part number: ";
cin >> partno;
length = strlen(partno);
if(length == 4 || length == 5)
{
if((partno[1] == 'M' || partno[1] == 'm') && (partno[2] == 'S' || partno[2] == 's'))
cout << "\nDelivery Method is : Mail - Standard. ";
else if((partno[1] == 'M' || partno[1] == 'm') && (partno[2] == 'P' || partno[2] == 'p'))
cout << "\nDelivery Method is : Mail - Priority. ";
else if((partno[1] == 'F' || partno[1] == 'f') && (partno[2] == 'S' || partno[2] == 's'))
cout << "\nDelivery Method is : FedEx- Standard. ";
else if((partno[1] == 'F' || partno[1] == 'f') && (partno[2] == 'O' || partno[2] == 'o'))
cout << "\nDelivery Method is : FedEx - Overnight. ";
else if((partno[1] == 'U' || partno[1] == 'u') && (partno[2] == 'P' || partno[2] == 'p'))
cout << "\nDelivery Method is : UPS. ";
else
cout << "\nDelivery Method should be one of MS, Mp, FS, FO or UP";
}
else
cout << "\nLength of the partnumber should be 4 or 5 characters.";
return 0;
}
Topic archived. No new replies allowed.